Calculating Total MTD Sales in Visual Studio

  • Calculating Total MTD Sales in Visual Studio

    Posted by DSC Communities on January 24, 2019 at 11:58 am
    • Sheila Scott

      Member

      January 24, 2019 at 11:58 AM

      Please can anyone help me to calculate Total MTD Sales. I have a sales file and a file with dates loaded into Visual Studio. I have created a relationship between the sales file on Invoice Date, which is in Julian format (CYYDDD) and a similar field in the dates file. There is a column in the dates file which corresponds to the julian date in the format dd/mm/yyyy.
      This is the formula I am using :
      Measure 1:=TOTALMTD(SUM(FH42044BI[A6$PEP]),FH42044BI[A6IVD],STARTOFMONTH,TODAY())
      where A6$PEP is the extended sales value and A6IVD is the Invoice date in Julian format

      ——————————
      Sheila Scott
      IT Business Analyst
      Hemel Hempstead
      +441442458257
      ——————————

    • Andrew Foulk

      Member

      January 25, 2019 at 8:32 AM

      Hello Sheila,
      Are you asking how to calculate the MTD in Visual Studio or in Power BI?
      If in PBI, you can use:

      Total Sales = SUM(Ā  ‘sales_table'[sales_column] )

      *then using that Total Sales measure you use the below for MTD

      SalesĀ MTD =
      IF (
      Ā Ā Ā  LASTDATE ( ‘*date_table'[date_column] )
      Ā Ā Ā Ā Ā Ā Ā  > TODAY (),
      Ā Ā Ā  BLANK (),
      Ā Ā Ā  CALCULATE ( [Total Sales], DATESYTD ( ‘*date_table'[date_column] ) )
      )

      The reason I do it like this was learning from Sam McKay (Enterprise DNA) that this works best in Charts because it helps cut off where the results go to when dates are still blank. If you did not want to do this, you would just use the CALCULATE portion of the measure for your MTD.

      CALCULATE ( [Total Sales], DATESYTD ( ‘*date_table'[date_column] ) )

      I’m hoping since this is a Power BI group you were asking for it in BI and not for in Visual Studio as your subject seems to mention.

      ——————————
      Best Regards,
      Andrew Foulk
      ——————————
      ——————————————-

    • Sheila Scott

      Member

      January 25, 2019 at 9:52 AM

      Hi Andrew
      Thanks for your response.

      I’mĀ creatingĀ a data model inĀ Visual Studio, not PowerBI?. Would it make more sense to calculate MTD Sales in PowerBI as that is where we want to display the data, ultimately?

      ——————————
      Sheila Scott
      IT Business Analyst
      Hemel Hempstead
      +441442458257
      ——————————
      ——————————————-

    • Andrew Foulk

      Member

      January 28, 2019 at 8:23 AM

      Hi Sheila,
      I would yes to doing all of the calculating within Power BI. Power BI has so much flexibility and capabilities that it wouldĀ be best in this situation to just bring in your data from any and all sources and then use DAX to compile your calculations. This way you shouldn’t need to worry about any results being skewed due to calculations occurring within another program or source and then doing the same within Power BI.?

      The alternative would be is you were using analysis services like Azure AS or SSAS since those would likely be setup to be calculating on the complete data set.

      ——————————
      Best Regards,
      Andrew Foulk
      ——————————
      ——————————————-

    • Sheila Scott

      Member

      January 28, 2019 at 10:49 AM

      Hi Andrew

      We are using DAX in SSAS. Can you tell me what the formula should be to calculate Total MTD Sales

      ——————————
      Kind regards
      Sheila Scott
      IT Business Analyst
      Hemel Hempstead
      +441442458257
      ——————————
      ——————————————-

    • Hasham Niaz

      Member

      January 28, 2019 at 2:55 PM

      Hi Sheila,

      Try the same DAX formula mentioned above, you are using Tabular Version of SSAS Cube.

      Regards,

      ——————————
      Hasham Bin Niaz
      Sr. BI Consultant
      Karachi, Pakistan
      ——————————
      ——————————————-

    • Andrew Foulk

      Member

      January 30, 2019 at 8:32 AM

      Hi Sheila, you would should be able to use the same formulas, just replace where it has YTD with MTD. I’m not familiar with SSAS yet myself but I would assume that make no difference on the DAX formulas.?

      ——————————
      Best Regards,
      Andrew Foulk
      ——————————
      ——————————————-

    DSC Communities replied 6 years, 10 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

The discussion ‘Calculating Total MTD Sales in Visual Studio’ is closed to new replies.

Start of Discussion
0 of 0 replies June 2018
Now

Welcome to our new site!

Here you will find a wealth of information created for peopleĀ  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!