Comments (7)
Can you provide the code of the underlying measure(s) ?
from daxstudio.
@marcosqlbi I think I can see the issue. The way [Days to Transfer] used in the calculate makes it look like a measure reference, but then there is also a reference to it inside the values function in the filter where it would also have to be a column reference.
So I think we have that new potential issue we identified with the PowerBI where it's possible to have a column in one table that has the same name as a measure in another table. Then the "expand" feature is incorrectly trying to expand both the measure and the column reference leading to an infinite loop where it eventually overflows the string buffer.
So I think we need to check if the character immediately proceeding the [Days to Transfer]
string is NOT one of the following:
- an alphanumeric character
- a single quote
To ensure that we only expand measure references and not column references.
I have a test PBIX file where I was able to reproduce this issue and code a fix
from daxstudio.
In reality you might have a column reference without the table name (e.g. in a SUMX or FILTER function), so this could be not enough. However, I see the problem in being too much restrictive here. Probably the best would be:
- Check whether the character immediately proceeding the measure is not an alphanumeric character or a single quote
- If condition 1) happens, evaluate whether the measure has the same name of a column in the data model.
- If condition 2) is true, then show a warning to the user asking whether he wants to go ahead with the replace or not. If the user cancel, don't do anything
- If condition 2) is false or condition 1) is false, do the replace
What do you think about this approach?
from daxstudio.
Yes, I think you are right. The current change I've made will expand out local column references incorrectly as if they were measure references. I'll need to see if I can refine it further along the lines you've suggested. But from my testing it appears that the Tabular engine will resolve the "short" form of a name to a column from the current table if one exists, otherwise it will resolve to the measure, so I think we should maybe do the same.
from daxstudio.
Yes, but the problem is that understanding what is the "current" table is very complex, we should parse the DAX syntax. You can solve the problem easily just in a calculated column, but what if you have:
SUMX ( Categories, SUMX ( RELATEDTABLE ( Products ), [Price] ) )
Then Price could be, in this order:
- a column in Products
- a column in Categories
- a Measure
I think that using measures and columns with the same name should be forbidden (and it is in Power Pivot and SSAS Tabular UI). Thus, if an author wants to go against the best practices, well, we will provide no support for measure expansion... :)
Let me know if I should take a look to the code, too.
from daxstudio.
Forgive me for not responding sooner - I did not see the first few comments.
The measure [Days to Transfer] is simply AVERAGE( Investigations[Days to Transfer] ). However, Investigations[Days to Transfer] is a calculated column that provides the days between two other date column values in Investigations (1M row fact table).
But this is where it gets messy because the resulting DATEDIFF of the two date columns can produce a negative result. So the DATEDIFF has to be wrapped in a SWITCH statement in order to accommodate both positive and negative scenarios.
This leads me to the next question - should I create an intermediary table that simply contains the calculated columns (there are more than one) from the fact table?
Thanks for your help.
from daxstudio.
SQLBI site is working - what is the page you are trying to access?
Please write to [email protected] if you need assistance for that, thanks!
from daxstudio.
Related Issues (20)
- Persist Parameters HOT 2
- Features Request: RDL Support HOT 2
- DaxFormatter.com Error
- Using DAX Studio for first time- need help with connecting HOT 2
- Dax Studio 3.0.11 - Windows 10 - Lockdown Enterprise Laptop "Could not load file or assembly 'DaxStudio.SqlFormatter' ... The system cannot find the file specified HOT 5
- Power BI Easy option to make model case sensitive in DAX Studio HOT 1
- Dax studio HOT 3
- View Metrics admin access issue | XMLA connection - Datamart's semantic model HOT 3
- CTRL + Backspace should put the cursor at the start of the current line HOT 3
- Server Timings and Query Plan only work once HOT 2
- Very minor correction in Writing DAX Queries documentation HOT 1
- Log function for EVALUATE HOT 3
- Formatting a measure output negates a retrieval of a filter for ",Not(ISBLANK( {measure with missing values} ))}" HOT 1
- dax studio not accepting short server address HOT 3
- Load Perf Data export icon doesn't work HOT 6
- Format Query Option: One Line HOT 4
- Cannot connect to SSAS tabular DB: Error connecting: No such host is know HOT 1
- DMV for Calculated Table Expression
- "View As" Does Not Work Properly when Connected to a Power BI XMLA Endpoint HOT 1
- Incorrect Total Time in bottom right side HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from daxstudio.