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.
I am facing an issue calculating the hours for the previous, current and next month. The sample data I have is as below.
Based on the date I would like to calculate the Available, Allocated and Consumed Hours. I would like the result to be in the way below.
Currently my matrix shows the total hours for each. I want to show the previous, current and next month hours for all three i.e. Available, Allocated and Consumed.
Hope you can help me with this. Thank you in advance.
Solved! Go to Solution.
Hi @VipinReddy,
You need create a dimension table as:
Date slicer =
VALUES('Table'[Date])
Try measure as:
Allocate_curr_month =
CALCULATE(
MAX('Table'[Allocate]),
FILTER(
'Table',
'Table'[Date]=MAX('Date slicer'[Date])))
Allocate_next_month =
CALCULATE(
MAX('Table'[Allocate]),
FILTER(
'Table',
MONTH('Table'[Date])=MONTH(MAX('Date slicer'[Date]))-1)
)
Allocate_pre_month =
CALCULATE(
MAX('Table'[Allocate]),
FILTER(
'Table',
MONTH('Table'[Date])=MONTH(MAX('Date slicer'[Date]))+1)
)
Here is the output:
The pbix is attached.
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
Hi @VipinReddy,
You need create a dimension table as:
Date slicer =
VALUES('Table'[Date])
Try measure as:
Allocate_curr_month =
CALCULATE(
MAX('Table'[Allocate]),
FILTER(
'Table',
'Table'[Date]=MAX('Date slicer'[Date])))
Allocate_next_month =
CALCULATE(
MAX('Table'[Allocate]),
FILTER(
'Table',
MONTH('Table'[Date])=MONTH(MAX('Date slicer'[Date]))-1)
)
Allocate_pre_month =
CALCULATE(
MAX('Table'[Allocate]),
FILTER(
'Table',
MONTH('Table'[Date])=MONTH(MAX('Date slicer'[Date]))+1)
)
Here is the output:
The pbix is attached.
If you still have some question, please don't hesitate to let me known.
Best Regards,
Link
Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!
@VipinReddy , with help from a date table and time intelligence
MTD Sales = CALCULATE(SUM(Table[hour]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Table[hour]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
next MTD Sales = CALCULATE(SUM(Table[hour]),DATESMTD(dateadd('Date'[Date],1,MONTH)))
last month Sales = CALCULATE(SUM(Table[hour]),previousmonth('Date'[Date]))
next month Sales = CALCULATE(SUM(Table[hour]),nextmonth('Date'[Date]))
this month = CALCULATE(Table[hour]),DATESMTD(ENDOFMONTH('Date'[Date])))
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
105 | |
79 | |
69 | |
62 |
User | Count |
---|---|
142 | |
105 | |
103 | |
85 | |
70 |