Forum Discussion
Field Parameters in Measures
Hello Anonymous ,my requirement is similar to nitinrungta . I need to create a field parameter called 'Month Year' (Eg: May 2022) and need to use this parameter in my YTD calc. This parameter needs to act as a slicer and every new selection should be reflecting in the YTD. If I select June 2022, then YTD calc will take upto June 2022. By default it should show YTD till current month.
Hi,
You don't need a field parameter for this. Just a clever Measure should take care of this.
- Anonymous3 years agoNot applicable
Okay, so this is the base calc :
Measure_to_get_total = CALCULATE ( SUM ( sales_table[Revenue] ), FILTER(sales_table, YEAR( sales_table[date])=2022 and month <= selected month))
Slicer selected : May 2022 (I need to get sum of sales from Jan 2022 to May 2022)
No slicer selected : Current Month (I need to get sum of sales from Jan 2022 to current month)
How can we achieve this with measure? The highlighted red part is what needs to be dynamic.
I tried by using 'selectedvalue' but it does not seem to be working
- nitinrungta3 years agoFrequent Visitor
Anonymous Yeah, Field Parameters might be an easy option but it can be done through measure and a slicer slider also. I have done similar work before.
Probably it is very easy or I am not understanding it.
But why don't you use a Total YTD function and A slider of Month Numbers? Since it is the month that you are wanting to keep dynamic. And also keep a slicer (or slider) or a year too.
- nitinrungta3 years agoFrequent Visitor
Anonymous try this calculation, and probably put the year filter in the measure or slicer as you see best fit. The month also you can connect at a slicer level or a MMYYY slicer should also work.
The thing is you don't need to get too attached to the month being a measure. Let the measure be free-flowing then you can control it anyhow.
Cumulative =
CALCULATE (
[Revenue],
FILTER (
ALLSELECTED( 'Date'[Date] ),
'Date'[Date]<= MAX ( 'Date'[Date] ) )
)