Forum Discussion
DAX expression I cannot get to work - please help.
- 8 years ago
Here's what worked but I don't understand why!
I just added the red part and all worked.
% of Premium = DIVIDE(SUM('Agency Scorecard 3'[Earned Premium]), CALCULATE(SUM('Agency Scorecard 3'[Earned Premium]), ALLEXCEPT('Agency Scorecard 3','Agency Scorecard 3'[Loss Year]),'Agency Scorecard 3'[Summary Line ID],'Business Division'[BusinessDivisionID], VALUES('Business Division'[BusinessDivisionID])), 0)
Thanks all for your help in getting me on the right track.
Here's the post that explains why the Values function works so now I know.
https://community.powerbi.com/t5/Desktop/ALLEXCEPT-only-working-on-visible-row-context/td-p/18030
You keep adding for all your report (might work with page/visualisation filters I don;t know) filters as follows:
% of Premium = DIVIDE(SUM('Agency Scorecard 3'[Earned Premium]), CALCULATE( SUM('Agency Scorecard 3'[Earned Premium]), ALLEXCEPT('Agency Scorecard 3','Agency Scorecard 3'[Loss Year]),'Agency Scorecard 3'[Summary Line ID],'Business Division'[BusinessDivisionID], VALUES('Business Division'[BusinessDivisionID]), VALUES('Agent'[Agent Alternate 1]), VALUES('Agent'[Agent Alternate 2]), VALUES('Sub Producer'[Alt Sub Producer 2]), VALUES('Managing Unit'[Managing Unit Name]), VALUES(Office[Office]), VALUES('Product Line'[Product Line Name]), VALUES(Underwriter[Underwriter Name]) ),0)
Hi. Thanks but that gave 7.28% for the example I gave. I donlt even know how 7.28% is caculated.
- Zubair_Muhammad8 years agoCommunity Champion
Hi Sureshot
Actually ALLSELECTED works on Totals. It does not impact Row and Column filters
Could you share your file via googledrive or onedrive?
- Sureshot8 years agoHelper I
I don;t yet have either of thse accounts but I can look into setting one up and sending my pbix file.
The thing is here I am looking to get row totals. AllSelected works great for columns but now row columns i.e. I need to get the 793,274,434 figure as the divisor.
- tjd8 years agoImpactful Individual
Have you tried using:
% of Premium = SUM('Agency Scorecard 3'[Earned Premium]) / CALCULATE(SUM('Agency Scorecard 3'[Earned Premium]), ALLSELECTED('Agency Scorecard 3'[Earned Premium]))?
For the row you've selected, you need to tell it what should remain unfiltered. Your expression (ALLSELECTED()) is telling it to unfilter everything which results in the % of total, not row.