Skip to content

Instantly share code, notes, and snippets.

@deldersveld
Created October 15, 2016 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deldersveld/9a29994389928267372eb8ed80691fcb to your computer and use it in GitHub Desktop.
Save deldersveld/9a29994389928267372eb8ed80691fcb to your computer and use it in GitHub Desktop.
Some DAX snippets for % of Grand Total
//Single measure version
% of Total = DIVIDE(SUM('Sales'[Revenue]), CALCULATE(SUM('Sales'[Revenue]), ALLSELECTED('Product'[Category])))
//As traced in Power BI Quick Calc "% of Grand Total"
EVALUATE
TOPN(
1001,
SUMMARIZECOLUMNS(
'Product'[Category],
"M0", CALCULATE(
DIVIDE(SUM('Sales'[Revenue]), CALCULATE(SUM('Sales'[Revenue]), ALLSELECTED('Product'[Category])))
)
),
'Product'[Category],
1
)
ORDER BY
'Product'[Category]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment