Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
monojchakrab
Resolver III
Resolver III

Totalling error in MTD sales

Hi All,

 

Here is a screenshot of the dashboard which is showing wrong totals :

 

Screenshot (11).png

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 ) :

monojchakrab_0-1678113626256.png

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

 

4 REPLIES 4
amitchandak
Super User
Super User

@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

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@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

amitchandak
Super User
Super User

@monojchakrab , Is LMSP Value is same as Total Sales ?

 

if yes

Can you share calculation all related measures in tax format

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

@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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.