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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
tulsi
Helper I
Helper I

Month over Month Comparison from previous year

Hey,

I have three columns in my dataset, month, task name and hours. I have to compare the % change of hours by task name month over month from last year. Can you help me with this.

 

Thanks

1 ACCEPTED SOLUTION

@tulsi ,

 

Click on the change column and click Modeling-> Format, change the format to percentage.

Capture.PNG 

 

Community Support Team _ Jimmy Tao

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

4 REPLIES 4
v-yuta-msft
Community Support
Community Support

@tulsi ,

 

Generally, you can create a measure using DAX below:

Change =
VAR Current_Month =
    MONTH ( Table[Date] )
VAR Previous_Month = Current_Month - 1
VAR Current_Month_Hours =
    CALCULATE (
        SUM ( Table[Hours] ),
        FILTER ( Table, MONTH ( Table[Date] ) = Current_Month )
    )
VAR Previous_Month_Hours =
    CALCULATE (
        SUM ( Table[Hours] ),
        FILTER ( Table, MONTH ( Table[Date] ) = Previous_Month )
    )
RETURN
    IF (
        YEAR ( Table[Date] )
            >= YEAR ( TODAY () ) - 1,
        Current_Month_Hours - Previous_Month_Hours / Previous_Month_Hours,
        BLANK ()
    )

Community Support Team _ Jimmy Tao

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

 

Hey,

I tried your DAX formula to create a calculated formula like this;

Change =
VAR Current_Month =
Month (Final[Month])
VAR Previous_Month = Current_Month - 1
VAR Current_Month_Hours =
CALCULATE(
SUM( Final[Total Number of Hours]),
FILTER(Final,MONTH(Final[Month])=Current_Month)
)
VAR Previous_Month_Hours =
CALCULATE(
SUM(Final[Total Number of Hours]),
FILTER(Final,MONTH(Final[Month])=Previous_Month)
)
RETURN
IF(
YEAR(Final[Month])
>= YEAR( TODAY() )-1,
Current_Month_Hours - Previous_Month_Hours / Previous_Month_Hours,
BLANK()
)

Now the result that I want is % change in the total number of hours by task name month by month but i'm getting something like this;Screenshot (20).png

@tulsi ,

 

Click on the change column and click Modeling-> Format, change the format to percentage.

Capture.PNG 

 

Community Support Team _ Jimmy Tao

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

Thanks for the reply. Do I need to create a calendar table first? Sorry I'm new to powerBI. The date mentioned in the third line 

 MONTH ( Table[Date] 

Is this from the calendar table?

 

Thanks 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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