Forum Discussion
Measure for Average displayed in Card Visual
- 5 years ago
OK, you'll need to replace Table[Business Unit] with year and month columns from your date table.
Avg per Month =AVERAGEX(SUMMARIZECOLUMNS(Date[Year], Date[Month],"@Cost", [Cost]),[@Cost]) - 5 years ago
Ok, the SUMMARIZECOLUMNS could be a problem in that case.
We can change that to a SUMMARIZE.
Avg per Month =AVERAGEX(SUMMARIZE(DIM_DATE, DIM_DATE[Year], DIM_DATE[Month]),[Cost Measure])
OK, you'll need to replace Table[Business Unit] with year and month columns from your date table.
Thank you very much!
Exactly what I was looking for.
Do you mind briefly explaning what the "@" in the function does?
- PaulOlding5 years ago
Solution Sage
The @ doesn't do anything. It's just a naming convention used by these guys https://www.sqlbi.com/ .
They explain why in this video https://www.sqlbi.com/tv/naming-temporary-columns-in-dax/
TL;DR "a naming convention for temporary columns in DAX expressions to avoid ambiguity with the measure reference notation."
- deboec5 years ago
Helper I
I do have one more question about your sintax:
If I use this part of your sintax:
SUMMARIZECOLUMNS(Date[Year], Date[Month],and I have 1 slicer visual in my canvas for Date[Year] and 1 slicer visual for Date[Month] to choose different years the measure doesn't work.
"Can't display the visual".
I can select 1 or more Months (e.g. Jan, Feb & Mar) but I cannot select a year.Any ideas?