Forum Discussion
Dynamic Measure Title Based on Slicer Selection
- 5 years ago
Hi, safrik
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Calendar(a calculated table):
Calendar = ADDCOLUMNS( CALENDARAUTO(), "YearMonth", YEAR([Date])*100+MONTH([Date]) )YM(a calculated table):
YM = DISTINCT('Calendar'[YearMonth])Relationship:
You may create a measure like below.
Result = var yearmonth = MAX(YM[YearMonth]) var lastym = CALCULATE( MAX('Calendar'[YearMonth]), FILTER( ALL('Calendar'), [YearMonth]<yearmonth ) ) return IF( MAX('Calendar'[YearMonth]) in {yearmonth,lastym}, SUM('Table'[Amount]) )Finally you need to use 'YearMonth' column from 'YM' table to filter the result and set the 'Result' as not blank.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, safrik
Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.
Table:
Calendar(a calculated table):
Calendar =
ADDCOLUMNS(
CALENDARAUTO(),
"YearMonth",
YEAR([Date])*100+MONTH([Date])
)
YM(a calculated table):
YM = DISTINCT('Calendar'[YearMonth])
Relationship:
You may create a measure like below.
Result =
var yearmonth = MAX(YM[YearMonth])
var lastym =
CALCULATE(
MAX('Calendar'[YearMonth]),
FILTER(
ALL('Calendar'),
[YearMonth]<yearmonth
)
)
return
IF(
MAX('Calendar'[YearMonth]) in {yearmonth,lastym},
SUM('Table'[Amount])
)
Finally you need to use 'YearMonth' column from 'YM' table to filter the result and set the 'Result' as not blank.
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you very much.