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.
Hi,
I´m trying to show cummulative hourse on a visualization, the thing is that i have two dates. Start and End Date.
I have this table:
Course | Total Hours | Stard Date | End Date |
1 | 100 | 01/07/2019 | 08/09/2019 |
2 | 50 | 05/03/2019 | 08/06/2019 |
3 | 35 | 21/07/2019 | 21/09/2019 |
4 | 15 | 15/09/2019 | 08/12/2019 |
I need to show accumulative hours from thouse dates. The thing is that if i show this on a visualization, i can only put on X axis only one date, Start or End Date. How can i manage this?
If i make a "Calendar table" i can only relation it with or either Start Date or End date
Thanks
Hi @Anonymous ,
Hi @Anonymous ,
You can use DATEDIFF function. These are my measures:
Days = DATEDIFF ( MAX ( 'Table'[Start Date] ), MAX ( 'Table'[End Date] ), DAY )
Hours per Day = DIVIDE ( MAX ( 'Table'[Total Hours] ), [Days] )
Months = DATEDIFF ( MAX ( 'Table'[Start Date] ), MAX ( 'Table'[End Date] ), MONTH )
Hours per Month = DIVIDE ( MAX ( 'Table'[Total Hours] ), [Months] )
This is my PBIX file.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Icey
That solution is perfect. The thing is that i have some courses that start and end in the same month. So when i execute those mesures i have some "Total hourse per month" in blank. And when i try to put an "Alternative result" when is "0" i can only put an constant numeric value (according to Power BI). And i need that in case of beeing "0" months it should show "Total Hours" column
Hope you understand
Regards
Hi @Anonymous ,
For Month = 0, try this:
Hours per Month = IF ( [Months] = 0, MAX ( 'Table'[Total Hours] ), DIVIDE ( MAX ( 'Table'[Total Hours] ), [Months] ) )
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi ICEY
This is almost ready.
The thing is that when i show this on a visualization it doesent work well.
This is because, when i put in a X Axis the month, (taken from End Date) I lose information.
See below:
TotalHoras | StartDate | EndDate | Months | Hours per Month |
48 | 03/05/2019 | 27/08/2019 | 3 | 16 |
48 | 03/05/2019 | 27/08/2019 | 3 | 16 |
48 | 03/05/2019 | 27/08/2019 | 3 | 16 |
But the 16 hours are only shown on month Agost or month May (depending on what date i use - Start or End)
I need that the 16 hs apear on June, July, And Agost.
Thanks!
Hi,
In a simple Table, please show the exact expected result.
Hi @Anonymous ,
You can create a column like this:
Start - End = COMBINEVALUES ( " - ", 'Table'[Start Date], 'Table'[End Date] )
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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 |
---|---|
110 | |
94 | |
80 | |
67 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |