Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Aggregate rolling 12 measure month As KPI

Hello community, 

 

I have build 2 measure for rolling 12 month and Y-1. 

These Measure work perfectly when a date dimension is in the visualisation but they dont work as KPI.... 

How can i do that with the same measure or low correction ? 

 

Annotation 2019-12-04 152019.png

 

These measure was based on these formula : 

 

Current Period : 

 

calc_SalesCY = 
var Ldate = CALCULATE(date(max(Year[Year]);max('Month'[Month]);1)) //Last date

var Fdate = EDATE(Ldate;-12) 

var SumProfit = SUM('Sample - Superstore'[Sales]) //Calculation

return

 if(min('Date'[Date])<fdate;
         blank();
         if(min('Date'[Date])>Ldate;
                   blank();
                   SumProfit))

 

 Year-1 : 

 

Calc_SalesPY = 
var Ldate = CALCULATE(date(max(Year[Year]);max('Month'[Month]);1)) //Last date

var Fdate = EDATE(Ldate;-12) 

var SumProfit = CALCULATE(SUM('Sample - Superstore'[Sales]);SAMEPERIODLASTYEAR('Date'[Date])) //Calculation

return

 if(min('Date'[Date])<fdate;
         blank();
         if(min('Date'[Date])>Ldate;
                   blank();
                   SumProfit))

 

 

These Measure work perfectly when a date dimension is in the visualisation but they dont work as KPI.... 

How can i do that with the same measure or low correction ? 

 

WorkBook here

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@amitchandak 

Thanks for your answer. 

 

The solution is : 

calc_salesCY_KPI = 
SUMX(
    VALUES ('Sample - Superstore'[Order Date]);
    [calc_SalesCY]
)

 

 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

Can you try rolling like these

 

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date Filer],ENDOFMONTH(Sales[Sales Date]),-12,MONTH))  
Rolling 12 before 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date Filer],ENDOFMONTH(dateadd(Sales[Sales Date],-12,MONTH)),-12,MONTH))

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

My Recent Blog - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Anonymous
Not applicable

@amitchandak 

Thanks for your answer. 

 

The solution is : 

calc_salesCY_KPI = 
SUMX(
    VALUES ('Sample - Superstore'[Order Date]);
    [calc_SalesCY]
)

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.