Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
I have a requirement that needs to display 5 years of data if selected YTD, 12 months of data if selected MTD, selected month && 4 quarters of data if selected QTD.
How do I get 5 years of data?
Please drop me your suggestions or answers.
Hi @Powerbyosh ,
Here are the steps you can follow:
1. Enter – Create a table.
2. Create measure.
Flag =
var _select=SELECTEDVALUE('Table2'[Group])
var _today=TODAY()
return
SWITCH(
TRUE(),
MAX('Table2'[Group])="YTD" && MAX('Table'[Date]) >= DATE(YEAR(_today)-5,MONTH(_today),DAY(_today))&& MAX('Table'[Date]) <= _today,1,
MAX('Table2'[Group])="MTD" && MAX('Table'[Date]) >= DATE(YEAR(_today)-1,MONTH(_today),DAY(_today))&& MAX('Table'[Date]) <= _today,1,
MAX('Table2'[Group])="QTD" && MAX('Table'[Date]) >= DATE(YEAR(_today),MONTH(_today)-4,DAY(_today))&& MAX('Table'[Date]) <= _today,1,0
)
Measure =
SUMX(
FILTER(ALLSELECTED('Table'),'Table'[Date]<=MAX('Table'[Date])),[rand])
3. Place [Flag]in Filters, set is=1, apply filter.
4. Result:
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Thank you. It worked
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
45 | |
25 | |
19 | |
16 | |
8 |
User | Count |
---|---|
70 | |
48 | |
45 | |
19 | |
16 |