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,
Just need some advice for my measures to calculate YTD and YTD Last Year.
Basically I want to create 2 visualization :
1. Column chart
2. Area chart
So I created these 2 measures:
and
At first those were ok :
But then I realized the area chart is incorrect, because it dragging the last value of March 2019 all the way to future months.
So I changed the YTD measures to be :
Value YTD = IF(LASTDATE('Dates'[DateKey] > TODAY(), BLANK(), TOTALYTD(SUM('Inventory'[value]),'Inventory'[DateKey])))
The area chart is correct now :
But my column chart is false, obviously because it does not have Date dimension over there. So now it is blank
Should I create different measure for each visulization ? or the I did is wrong ?
Thanks in advance,
Solved! Go to Solution.
With these measures
ytd = TOTALYTD(SUM(Sheet1[sales]),Sheet1[date],FILTER('date',MONTH('date'[Date])<MONTH(TODAY()))) ly ytd = CALCULATE(TOTALYTD(SUM(Sheet1[sales]),Sheet1[date]),SAMEPERIODLASTYEAR('date'[Date]))
In addition, TOTALYTD Evaluates the year-to-date value of the expression in the current context.
So the value is accumulated till the end of the year.
To get your line chart, you need replace TOTALYTD with TOTALMTD which Evaluates the value of the expression for the month to date, in the current context.
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Is this problem sloved?
If it is sloved, could you kindly accept it as a solution to close this case?
If not, please let me know.
Best Regards
Maggie
With these measures
ytd = TOTALYTD(SUM(Sheet1[sales]),Sheet1[date],FILTER('date',MONTH('date'[Date])<MONTH(TODAY()))) ly ytd = CALCULATE(TOTALYTD(SUM(Sheet1[sales]),Sheet1[date]),SAMEPERIODLASTYEAR('date'[Date]))
In addition, TOTALYTD Evaluates the year-to-date value of the expression in the current context.
So the value is accumulated till the end of the year.
To get your line chart, you need replace TOTALYTD with TOTALMTD which Evaluates the value of the expression for the month to date, in the current context.
Best Regards
Maggie
Community Support Team _ Maggie Li
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |