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.
Hello Fellow Power BI Users!
I need help with a calculation that I tried and just haven’t been able to get right. On the table below I have a 3 construction jobs that each finish at different times. On the first month (and first month only) that a job is 100% complete, the ‘First month 100%’ column will indicate ‘yes’. I want to do a YTD for all the ‘Yes’ for each year. The YTD measure I currently have does not reset back to zero and start the count again at the beginning of a new calendar year.
Table:
Measure that I need help with:
I appreciate any help you might be able to provide.
@NutNick1982 , create the calculation of yes, that it should give 1 and 0.
The use datesytd.
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
if need at values(Date[Dates])
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
Thanks for your response, I appreciate it. The changing of 'First Month 100%' makes sense and I did so:
However the measure still isnt giving the result I want. Here's how I input:
And the corresponding output for the measure:
The "YTD Sales" should maybe more like a TOTALYTD? For example, if one Job gets to 100% the Total YTD should be 1 there after until the new year or when anothe job reaches 100%. Something like this:
Thanks for your help!
Hi @NutNick1982 ,
Not quite understand your output?Is "YTD Sales" your expected output?How does it happen?
Hi, the "YTD sales" should be a culumative sum by year. It should culumatively count the "first month 100%" column then on the start of a new calendar year, restart that count.
Hi @NutNick1982 ,
Create a column as below:
YTD Sales =
var _prefirstmonth=CALCULATE(MAX('Table'[First Month 100%]),FILTER('Table','Table'[Date]<=EARLIER('Table'[Date])&&YEAR('Table'[Date])=YEAR(EARLIER('Table'[Date]))))
var _count=CALCULATE(COUNT('Table'[First Month 100%]),FILTER('Table',YEAR('Table'[Date])=YEAR(EARLIER('Table'[Date]))))
Return
IF(_prefirstmonth=0,0,IF('Table'[First Month 100%]=1||_prefirstmonth=1,
IF(_count=1,1,
IF(_count>1,
SUMX(FILTER(ALL('Table'),YEAR('Table'[Date])=YEAR(EARLIER('Table'[Date]))&&'Table'[Date]<=EARLIER('Table'[Date])),'Table'[First Month 100%])))))
And you will see:
For the related .pbix file,pls see attached.
Hi Kelly, It looks like this is the solution! does it matter that the 'First month 100%' is a measure and not a column? additionally your BI file doesnt seem to be opening....
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 |
---|---|
114 | |
100 | |
78 | |
75 | |
50 |
User | Count |
---|---|
144 | |
109 | |
108 | |
88 | |
61 |