The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
How do I get the previous month total hours based on the month filter?
Solved! Go to Solution.
Hi @Anonymous ,
Please try below steps:
1.my test table
Table:
2.add a "Month" column to the table
Month = MONTH('Table'[Date])
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 )
)
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.
Hi @Anonymous ,
Please try below steps:
1.my test table
Table:
2.add a "Month" column to the table
Month = MONTH('Table'[Date])
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 )
)
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.
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
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
User | Count |
---|---|
11 | |
9 | |
6 | |
6 | |
5 |
User | Count |
---|---|
22 | |
14 | |
14 | |
9 | |
7 |