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 Team,
I have one requirement in which need to display sum of sales for last 5 years of selected quarter. eg:
if I select 2022 Q1 than it should display the trend of 2021 Q1, 2020 Q1, 2019 Q1, 2018 Q1 and so on. similarly for other selections as well.
I have tried with samePeriodlastyear or parallalperiod but they all are limited to 1 year or may be other as well but comparison will happen only between 2 attribute but my Requirement is to display last 5 years quarters based on my selection in slicer.
Any help would be appreciated.
Thanks
Solved! Go to Solution.
Hi @Anonymous
I solved a similar problem before, you can refer to it, Solved: Show 13 months for a chosen year in a diagram - Microsoft Power BI Community
For questions about quarter, you can try this,
(1) create dimdate and slicer table
(2) create the measure
Measure =
var _selectedYQ=SELECTEDVALUE(Slicer[YQ])
var _selectedY=SELECTEDVALUE(Slicer[Y])
var _selectedQ=SELECTEDVALUE(Slicer[Q])
var _startY=_selectedY-4
var _sumPerYQ=CALCULATE(SUM(FactTable[value]),FILTER(ALL(FactTable),Quarter(FactTable[date])=MIN(DimDate[Quarter]) && YEAR(FactTable[date])= MIN(DimDate[Year])))
return IF(MIN(DimDate[Year])>=_startY && MIN(DimDate[Year])<=_selectedY && MIN(DimDate[Quarter])=_selectedQ,_sumPerYQ,BLANK())
result
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
I solved a similar problem before, you can refer to it, Solved: Show 13 months for a chosen year in a diagram - Microsoft Power BI Community
For questions about quarter, you can try this,
(1) create dimdate and slicer table
(2) create the measure
Measure =
var _selectedYQ=SELECTEDVALUE(Slicer[YQ])
var _selectedY=SELECTEDVALUE(Slicer[Y])
var _selectedQ=SELECTEDVALUE(Slicer[Q])
var _startY=_selectedY-4
var _sumPerYQ=CALCULATE(SUM(FactTable[value]),FILTER(ALL(FactTable),Quarter(FactTable[date])=MIN(DimDate[Quarter]) && YEAR(FactTable[date])= MIN(DimDate[Year])))
return IF(MIN(DimDate[Year])>=_startY && MIN(DimDate[Year])<=_selectedY && MIN(DimDate[Quarter])=_selectedQ,_sumPerYQ,BLANK())
result
Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
you can try something like
CALCULATE (
[Measure],
Date[Year] <= MAX ( Date[Year] ),
Date[Year] >= MAX ( Date[Year] ) - 5
)
Hi @tamerj1 ,
Thanks for your response on this. Actually My requirment is to display data of same quarter previous years (eg: if I select 2021 q4 then it should display 2020 q4, 2019 q4,2018 q4......) with solution provided above , not able to achieve this. May be if you can explain more in details than it would be helpful for me.
Thanks in advance.
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 |
---|---|
46 | |
28 | |
22 | |
12 | |
8 |
User | Count |
---|---|
75 | |
53 | |
46 | |
15 | |
12 |