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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Previous month in a card based on month filter

How do I get the previous month total hours based on the month filter?

Measure 4 = CALCULATE([Total Hours], PREVIOUSMONTH('Jersey'[Posting Date]))
It is showing blank. 
 
Please help 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

Please try below steps:

1.my test table

Table:

vbinbinyumsft_0-1661136095869.png

2.add a "Month" column to the table

 

Month = MONTH('Table'[Date])

 

vbinbinyumsft_1-1661136151347.png

3. create two measure and add it to table visual

 

Total Hour = SUM('Table'[Spend Hour]) 
Pre_Total_Hour =
VAR cur_month =
    SELECTEDVALUE ( 'Table'[Month] )
RETURN
    CALCULATE (
        [Total Hour],
        FILTER ( ALL ( 'Table' ), 'Table'[Month] = cur_month - 1 )
    )

 

vbinbinyumsft_2-1661136249033.png

Please refer my attached .pbix file

 

Best regards,
Community Support Team_ Binbin Yu
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

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

Please try below steps:

1.my test table

Table:

vbinbinyumsft_0-1661136095869.png

2.add a "Month" column to the table

 

Month = MONTH('Table'[Date])

 

vbinbinyumsft_1-1661136151347.png

3. create two measure and add it to table visual

 

Total Hour = SUM('Table'[Spend Hour]) 
Pre_Total_Hour =
VAR cur_month =
    SELECTEDVALUE ( 'Table'[Month] )
RETURN
    CALCULATE (
        [Total Hour],
        FILTER ( ALL ( 'Table' ), 'Table'[Month] = cur_month - 1 )
    )

 

vbinbinyumsft_2-1661136249033.png

Please refer my attached .pbix file

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Whitewater100
Solution Sage
Solution Sage

Hi:

The other gemtleman suggested using a date table,marked as date table and then forming a relationship. Please see attached example. I hope this helps!https://drive.google.com/file/d/1QoGYST_Gu96qMO9TURHxRtcO2sj8tmI7/view?usp=sharing 

 

Whitewater100_0-1661129907157.png

 

lbendlin
Super User
Super User

Time intelligence functions are very much expecting a calendar table with contiguous unique dates .  Doesn't look like you have that in your example.

 

Please provide sanitized sample data that fully covers your issue. I can only help you with meaningful sample data.
Please paste the data into a table in your post or use one of the file services like OneDrive or Google Drive.
https://community.powerbi.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-...

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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