Forum Discussion
Challenges with ALLSELECTED and iterators
Hi MattBI ,
I don't think there's actually really an issue in using any functions within Power BI. Sure, there's always a preference over another but if your results are right and it doesn't bog down your model / visuals then go ahead and use it.
For your second measure, I would perhaps add the calculation within the summarize table such as this:
VAR summarizeTable =
SUMMARIZE(
SourceData,
SourceData[Period],
SourceData[client],
Products[DESCRIPTION],
Sales[DESCRIPTION],
"@Result", [Weight] * [Benchmark]
)
RETURN
SUMX(summarizeTable, [@Result])
Hmmm... that didn't return any results.
I've heard that it's not a good pratice to create computed columns in a SUMMARIZE statement, so I added an ADDCOLUMNS to it, which worked, but unfortunately, that has the exact same behavior as my original measure definition.
- hnguy713 years agoSuper User
MattBI, I think the answer to this also is that it really just depends on the application. If you wanted to do just a basic output then yes ADDCOLUMNS is more preferred, however, if you want to do a categorical sum or rollup then SUMMARIZE alone is sufficient. I use both methodlogy just depends on what is required for my specific circumstances.
If by adjusting any formula or expression making it more complicated without any clear performance gains within your model then you're doing it wrong. Just my opinion.
- MattBI3 years agoRegular Visitor
Thanks again for your response. I hear what you're saying. Unfortunately, as I mentioned above, using SUMMARIZE as you suggested returned no data for the rows in my output set. Using ADDCOLUMNS instead returned results, but they were the same as what I was seeing originally so unfortunately, it didn't help improve the situation.