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
azakir
Resolver I
Resolver I

Rolling by month

Hi Guys. 

I have the following formulas: 

 

Waste To Landfill Graph2_V1 = (CALCULATE([Waste to Landfill (Tonnes)_V1] * 0.95, DateDim[Previous Year] = 1))/12
Total_V2 =
VAR CurrentDate = MAX ( DateDim[Date] )
RETURN
CALCULATE (
    [Waste To Landfill Graph2_V1] ,
    FILTER (
        ALL ( DateDim ),
        DateDim[Date] <= CurrentDate
        && DateDim[Previous Year] = 1
    )
)
 
This gives me the following table: 

 

azakir_0-1708045082795.png

What I am after is how can I roll the total of Total_V2. For example, I would like Jan to be 695, Feb to be 695*2, Mar to be 695*3 and so on. 

 

Is there any way I can apply a rolling DAX Calculation to any of the measures?

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

Hi  @azakir ,

 

You can try the following dax.

 

MEASURE =
VAR _monthnumber =
    MONTH ( MAX ( 'DateDim'[Date] ) )
VAR CurrentDate =
    MAX ( DateDim[Date] )
VAR _sum =
    CALCULATE (
        [Waste To Landfill Graph2_V1],
        FILTER (
            ALL ( DateDim ),
            DateDim[Date] <= CurrentDate
                && DateDim[Previous Year] = 1
        )
    )
VAR _round =
    ROUNDDOWN ( _sum, 0 )
RETURN
    _round * _monthnumber

 

 

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.

View solution in original post

9 REPLIES 9
v-yangliu-msft
Community Support
Community Support

Hi  @azakir ,

 

You can try the following dax.

 

MEASURE =
VAR _monthnumber =
    MONTH ( MAX ( 'DateDim'[Date] ) )
VAR CurrentDate =
    MAX ( DateDim[Date] )
VAR _sum =
    CALCULATE (
        [Waste To Landfill Graph2_V1],
        FILTER (
            ALL ( DateDim ),
            DateDim[Date] <= CurrentDate
                && DateDim[Previous Year] = 1
        )
    )
VAR _round =
    ROUNDDOWN ( _sum, 0 )
RETURN
    _round * _monthnumber

 

 

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.

Hi @v-yangliu-msft This did the trick. Thank you

Ashish_Mathur
Super User
Super User

Hi,

What are you trying to achieve?  Why should Feb be 695.06*2 and so on?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur . Thanks for the reply. What I am trying to achieve is the total 695 being rolled up every month. So the requirement is whatever the total was last year (695 in this case) make it a target for this year with every month being rolled up by the same total.

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

You already are getting the correct result via the Total_V3 measure. What help do you need?

Ashish_Mathur_0-1708066694329.png

 

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

If you notice, I am just multiplying it by the month number. I was wondering if there is a more efficient way to use a rolling DAX measure. 

Hi,

File deleted from the link you shared earlier.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.