Forum Discussion
Year to date average
- 9 years ago
Hey Nicolas,
this apporach should work fine for you:
1) create a Date table without "holes" - prerequisite for the time intelligence to work properly
easiest way is to create a calculated table with the pattern
Date = CALENDAR( MIN( YourData[Start Date] ), MAX( YourData[Start Date] ) )
2) create a relationship between your data and the new date table
3) create a Measure that calculates the percentage for a given month:
for example:
Duration Billable Pct = DIVIDE( CALCULATE( SUM( YourData[Duration] ), YourData[Category] = "billable" ), CALCULATE( SUM( YourData[Duration] ), ALL( YourData[Category] ) ) )4) create a Measure that will give you the YTD/Running total of that Percentage, for example:
Duration Billable Pct YTD = TOTALYTD( [Duration Billable Pct], 'Date'[Date] )
Should result in sth like this:
Give it a try and let me know if it helps :-)
Hey Nicolas,
this apporach should work fine for you:
1) create a Date table without "holes" - prerequisite for the time intelligence to work properly
easiest way is to create a calculated table with the pattern
Date = CALENDAR( MIN( YourData[Start Date] ), MAX( YourData[Start Date] ) )
2) create a relationship between your data and the new date table
3) create a Measure that calculates the percentage for a given month:
for example:
Duration Billable Pct =
DIVIDE(
CALCULATE(
SUM( YourData[Duration] ),
YourData[Category] = "billable"
),
CALCULATE(
SUM( YourData[Duration] ),
ALL( YourData[Category] )
)
)
4) create a Measure that will give you the YTD/Running total of that Percentage, for example:
Duration Billable Pct YTD = TOTALYTD( [Duration Billable Pct], 'Date'[Date] )
Should result in sth like this:
Give it a try and let me know if it helps :-)
- greemlin9 years agoFrequent Visitor
Hi
Thank you for the fast reply.
It works perfectly.
I'll still try to understand the second method suggested to me for my knowledge, I'll also let you know if I succeed :)Again, thank you all,
Nicolas
- BetterCallFrank9 years ago
Resolver IV
Hi Nicolas,
in order to not use ALL you can write
Duration Billable Pct = DIVIDE( CALCULATE( SUM( 'MOCK_DATA csv'[Duration] ), 'MOCK_DATA csv'[Category] = "billable" ), CALCULATE( SUM( 'MOCK_DATA csv'[Duration] ), OR('MOCK_DATA csv'[Category] = "billable", 'MOCK_DATA csv'[Category] = "non billable" ) ) )HTH,
Frank
Please mark as solution and send Kudos if you learned a thing or two :)
- tringuyenminh929 years ago
Memorable Member
Hi greemlin,
You could remove not related group in Group by step:
B = SUMMARIZE(Activities,Activities[Month],Activities[MonthInt],"Bill",CALCULATE(sum(Activities[Activity Duration]),Activities[ActivitySimplied]="Others" && [groupcolumn] <> 'filtergrouphere'),"Non",CALCULATE(sum(Activities[Activity Duration]),Activities[ActivitySimplied]<>"Others" && [groupcolumn]='filtergrouphere' )
- DivyahsreeM8 years agoRegular Visitor
Hello,
Am very new to Power BI and i got requirement to calculate YTD. i followed the same steps to calculate YTD.. in my Table i have three columns(two columns are unpivoted columns, like success, error, all respective vaues for the same) Other column is list of months.. i have to calculate YTD of Vaues..
i have craeted one Date Table with one column which contains date frmo 01/01/2017 to 31/12/2017.
then i created one calculated column which is of the data type date respectively for each month, and i hvae careted the relationship between them,
now i have to create the Measure,
requirement is just need to add the values of different attribute respective of month and its previous months value..
am bit confused how to calculate the measureDuration Billable Pct = DIVIDE( CALCULATE( SUM( YourData[Duration] ), YourData[Category] = "billable" ), CALCULATE( SUM( YourData[Duration] ), ALL( YourData[Category] ) ) )