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 have table by country and quantity with month category.
I am bringing YTD quantity based on Max Function if current month equal to Max and i want to return until previous month YTD quantity.
By month i can able to get the desired result but in total its giving including the current month.
In the above example August also included in the total. but month fileterd untill July correctly.
Thanks,
Mani
Solved! Go to Solution.
Hi @Mani_ms ,
Do you want to calculate the cumulative value when the month is equal to today's month, the other months show the value of the current month?
For example, when the month name is Aug, it will calculate the cumulative value.
If yes, you can use the following measure.
Measure =
var _YTD = CALCULATE(SUM('Table'[quantity]),FILTER(ALLEXCEPT('Table','Table'[Country]),'Table'[Month number]<=MAX('Table'[Month number])))
var _currentmonth = FORMAT(TODAY(),"mmm")
var _sum = SUM('Table'[quantity])
return
IF(
MAX('Table'[Month name])=_currentmonth,_YTD,_sum)
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTW, pbix as attached.
Hi @Mani_ms ,
How about the result after you follow the suggestions mentioned in my original post?
Could you please provide more details or expected result about it If it doesn't meet your requirement?
If you've fixed the issue on your own please kindly share your solution. If the above posts help, please kindly mark it as a solution to help others find it more quickly.
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Mani_ms ,
You can remove VALUE from the formula.
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Hi @harshnathani ,
Value i have used to convert text to number for the period. Somewhere i am missing..
Hi @Mani_ms ,
Do you want to calculate the cumulative value when the month is equal to today's month, the other months show the value of the current month?
For example, when the month name is Aug, it will calculate the cumulative value.
If yes, you can use the following measure.
Measure =
var _YTD = CALCULATE(SUM('Table'[quantity]),FILTER(ALLEXCEPT('Table','Table'[Country]),'Table'[Month number]<=MAX('Table'[Month number])))
var _currentmonth = FORMAT(TODAY(),"mmm")
var _sum = SUM('Table'[quantity])
return
IF(
MAX('Table'[Month name])=_currentmonth,_YTD,_sum)
If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?
Best regards,
Community Support Team _ zhenbw
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
BTW, pbix as attached.
@Mani_ms , Not very clear. You can use time intelligence, if you date with date calendar.
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Power BI — YTD
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
Could you please help me out the YTD value prior period quantity based on current month.
@Mani_ms - This looks like a measure totals problem. Very common. See my post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907
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 |
---|---|
97 | |
96 | |
81 | |
74 | |
66 |
User | Count |
---|---|
129 | |
106 | |
106 | |
86 | |
72 |