Forum Discussion
DAX coalesce function consumes all available memory
- 5 years ago
Ok, vgeldbr - see if this helps. I think this is a modeling problem. Your aggregate status was another table in a 1:Many relationship with the Engagement Codes table, and the latter wasn't filtering the former.
I could have worked on some DAX to do some crossfiltering, but that is more complex than it needs to be. The Aggregate status is really just a lookup table it seems, so I just merged it into the Engagement table. You can see my results in the lower right.
This is a super simple measure.
Actuals = VAR varActualCount = COUNTROWS(Actuals) RETURN IF( ISBLANK(varActualCount), 0, SUM(Actuals[ExpenseUSDCurrentFYTD]) )If there are no rows in the Actuals for a given code, return zero, otherwise the total. At this point, your dim_engagement codes doesn't even need to be loaded. Use your Engagement codes as the DIM table and the Actuals as a FACT table - a perfect Star Schema. See my PBIX file here. Look at the merge I did in Power Query.
Microsoft Guidance on Importance of Star Schema
That is because by default, a blank result doesn't show up in the data, which is generally what you want. Everythign is showing up because you've told it "if there is a blank, give me a 0" and zeros do show up. I'm not sure that is what you want, but without data and expected results to test against, it is hard to say.
In the thread you linked to where I used COALESCE as a solution, the user didn't want any blanks, so COALESCE was a good solution there.
Thanks MattAllington and edhans for help so far. I've simplified this and am totally stuck. I've attached the simplified file which I hope demonstrates the issue.
- edhans5 years agoCommunity Champion
This measure returns the following results:
Actuals = COALESCE( SUM(Actuals[ExpenseUSDCurrentFYTD]), 0 )If that is not what you need, please provide an example (Excel screenshot is ok) of what you expect the results to be vgeldbr
- vgeldbr5 years agoHelper IV
edhans the screenshot below is what I expect to see/need to see:
For each engagement code there is only one line with the sum of all Actuals for that engagement code. Each engagement code could potentially have one of about 10 Engagement Statuses. These can be boiled down to 4 useful Aggregate Statuses from the "dim_Engagement Code Status" table.
- Anonymous3 years agoNot applicable
- edhans3 years agoCommunity Champion
You should start a new thread as this one has been marked solved.
But COALESCE has nothing to do with it. You are iterating over the entire DIM table because of the ALL() table, then doing some IF logic, which isn't a terribly efficient function, and that is creating a table and then applying that to a measure that I have no idea what it is doing.
The general rule is, filter columns, not tables. I would start by replacing the table in ALL with just the quarter reporting field as it seems that is all you need.
But again, a new thread, as this goes beyond COALESCE. And include the contents of your measure you are using modifying.How to get good help fast. Help us help you.
How To Ask A Technical Question If you Really Want An Answer
How to Get Your Question Answered Quickly - Give us a good and concise explanation
How to provide sample data in the Power BI Forum - Provide data in a table format per the link, or share an Excel/CSV file via OneDrive, Dropbox, etc.. Provide expected output using a screenshot of Excel or other image. Do not provide a screenshot of the source data. I cannot paste an image into Power BI tables.