The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi,
I have 2 slicers one for year and other for month. If I have selected year as 2021 and month as January, then need to show rolling 12 month sum for periods,
Solved! Go to Solution.
Hi,
Try these measures
Total sales = sum(Data[sales])
Sales in last 12 months = calculate([total sales],datesbetween(calendar[date],edate(min(calendar[date])-11),max(calendar[date])))
Sales before = calculate([Sales in last 12 months],sameperiodlastyear(calendar[date]))
Hope this helps.
Hi @AshDil .
In that case create 2 separate measures with little tweak in the same formula.
For last 12 months;
Rolling Sum for last year= CALCULATE(
[Total Sales],
DATESINPERIOD(Table[Date],
MAX(Table[Date]),
-1,
YEAR))
Rolling Sum before last 12 months=CALCULATE[Rolling Sum for last year],
SAMEPERIODLASTYEAR(Table[date]).
Please let me know if that works for you.
Regards,
Sanket Bhagwat
Hi,
Try these measures
Total sales = sum(Data[sales])
Sales in last 12 months = calculate([total sales],datesbetween(calendar[date],edate(min(calendar[date])-11),max(calendar[date])))
Sales before = calculate([Sales in last 12 months],sameperiodlastyear(calendar[date]))
Hope this helps.
Hi @AshDil .
1)Create a measure for Total Sales as;
Total Sales=SUM(Sales).
2)Create a measure for rolling sum as ;
Rolling Sum for last 2 years= CALCULATE(
[Total Sales],
DATESINPERIOD(Table[Date],
MAX(Table[Date]),
-2,
YEAR)).
Pleast let me know if it works.
Regards,
Sanket Bhagwat.
Hi @SanketBhagwat ,
If I have used above calculation I will get rolling sum for last 24 months i.e, FEB 2019 - JAN 2021, not for 12 month sum seperately.
I want to show 2 seperate 12 month sum for periods
Hi @AshDil .
In that case create 2 separate measures with little tweak in the same formula.
For last 12 months;
Rolling Sum for last year= CALCULATE(
[Total Sales],
DATESINPERIOD(Table[Date],
MAX(Table[Date]),
-1,
YEAR))
Rolling Sum before last 12 months=CALCULATE[Rolling Sum for last year],
SAMEPERIODLASTYEAR(Table[date]).
Please let me know if that works for you.
Regards,
Sanket Bhagwat
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
111 | |
80 | |
78 | |
43 | |
37 |
User | Count |
---|---|
158 | |
111 | |
64 | |
59 | |
54 |