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
SimoneOS
Frequent Visitor

rolling 12 month calculation with group

I need to create a rolling 12 month calculation - which ive done and it works but i need it to split by groups and not sure how to do this bit

 

Rolling12M = 
Var numofmonth = 12
Var Lastselecteddate = max('Reporting Periods'[Date Link])
Var Period = 
    DATESINPERIOD('Reporting Periods'[Date Link], Lastselecteddate, -numofmonth,MONTH)
var Result =
    CALCULATE(
        AVERAGEX(
            VALUES('Reporting Periods'[Calendar year month number]),
            [NetRevM]
        ),
        Period)
Var lastdatewithsale = max(RollingTable[Reporting Periods.FinMonthStart])
 Var firstvisibledate = MIN('Reporting Periods'[Date Link])
        Return
        if(firstvisibledate <=lastdatewithsale, Result)

 

the data is structured:

vwFcstCustomer.FinanceSplit2Reporting Periods.FinMonthStartNet Rev
Group 202/04/2016£1,133,027.66
Group 302/04/2016£28,527.47
Group 102/04/2016£57,602.39
Group 303/04/2016£295,144.53
Group 203/04/2016£855,062.72
Group 103/04/2016£38,124.40
Group 201/05/2016£770,586.56
Group 301/05/2016£98,030.51
Group 129/05/2016£39,131.44
Group 229/05/2016£1,061,408.65
Group 329/05/2016£103,863.89
Group 203/07/2016£814,903.60
Group 303/07/2016£73,218.20

 

Can anyone help?

1 ACCEPTED SOLUTION
v-yinliw-msft
Community Support
Community Support

Hi @SimoneOS ,

 

There are two methods:

1. You can use slicer:

vyinliwmsft_0-1669778634612.png

2.You can try this DAX:

Group1 = CALCULATETABLE('Table','Table'[vwFcstCustomer.FinanceSplit2] = "Group 1")
Group2 = CALCULATETABLE('Table','Table'[vwFcstCustomer.FinanceSplit2] = "Group 2")
Group3 = CALCULATETABLE('Table','Table'[vwFcstCustomer.FinanceSplit2] = "Group 3")

The result is:

vyinliwmsft_1-1669778755994.png

Hope these help you.

Here is my PBIX file.

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yinliw-msft
Community Support
Community Support

Hi @SimoneOS ,

 

There are two methods:

1. You can use slicer:

vyinliwmsft_0-1669778634612.png

2.You can try this DAX:

Group1 = CALCULATETABLE('Table','Table'[vwFcstCustomer.FinanceSplit2] = "Group 1")
Group2 = CALCULATETABLE('Table','Table'[vwFcstCustomer.FinanceSplit2] = "Group 2")
Group3 = CALCULATETABLE('Table','Table'[vwFcstCustomer.FinanceSplit2] = "Group 3")

The result is:

vyinliwmsft_1-1669778755994.png

Hope these help you.

Here is my PBIX file.

 

Best Regards,

Community Support Team _Yinliw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

Top Solution Authors