The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi All,
Here is a screenshot of the dashboard which is showing wrong totals :
The total in the MTD column for Feb is wrongly being calculated (the actual number if added from the base files shud be 2.8 L).
The measure is used is as follows (which btw is working perfectly for all other months ) :
The total sales is nothing but the value column summed.
The [date] column of the Date Table is linked to the Date column of the fact table and is returning the exact same number of rows as the source files.
Could there be something specific going wrong with Feb?
Any help much appreciated
Thanks
@monojchakrab , Try like
LMTD QTY forced=
Var _Maxdate = MAX('Date Table'[Date])
var _max = date(year(_Maxdate),month(_Maxdate)-1,day(_Maxdate))
return
if(max('Date'[Date])<=_max, CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max), blank())
//OR
//CALCULATE(Sum('order'[Qty]),DATESMTD(dateadd('Date'[Date],-1,year)),'Date'[Date]<=_max)
//TOTALMTD(Sum('order'[Qty]),dateadd('Date'[Date],-1,year),'Date'[Date]<=_max)
Comments are alternate options
@amitchandak - Amit, actually, surprisingly, the LMSP (last month same period), actually returns the right figure.
Its the MTD and only for the month of Feb, where there is a problem.
If there something else I need to look at? I dont think the measure is a problem as the same measures work fine for all other months.
Anyways - thank you for being in my corner
@monojchakrab , Is LMSP Value is same as Total Sales ?
if yes
Can you share calculation all related measures in tax format
@amitchandak - Amit, as for LMSP, I have tweaked the total sales figure to reflect the last month, which means for Feb, it shows Jan.
The measures used in dax format as below :
LMSP Val =
Var _Maxdate = MAX('Date Table'[Date])
Return
IF(DAY(_Maxdate)<>DAY(DATE(YEAR(_Maxdate),MONTH(_Maxdate)-1,DAY(_Maxdate))),
BLANK(),
CALCULATE(
TOTALMTD('Measures tray'[Total Sales], DATEADD('Date Table'[Date],-1,MONTH)
)
))
MTD Val =
TOTALMTD('Measures tray'[Total Sales],'Date Table'[Date])
let me know, if this helps, or if you need something more to work thru' this.
Thanks for the quick revert
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
76 | |
66 | |
52 | |
50 |
User | Count |
---|---|
121 | |
118 | |
77 | |
64 | |
63 |