Forum Discussion

NidhiBhusari's avatar
NidhiBhusari
Helper IV
4 years ago

Unable to get correct values using Time Intelligence functions

Hi Fam,

I need to calculate YTD, QTD & MTD sales depending on the date selection done in the slicer. Also, I want to do calculations for the exact same time frame selected in the slicer.

Steps that I have implemented:- 1) Created Calendar Table and established relationship with Fact Table as 1 to Many.

                                                    2) Used DATESYTD, DATESQTD & DATESMTD to calc the current year values.
                                                    3) For previous year DAX used - CALCULATE(SUM(SALES), SAMEPERIODLASTYEAR(DATESYTD(CALENDAR(Date)))).

Still I am not getting correct values.

Please help.

9 Replies

  • onurbmiguel_'s avatar
    onurbmiguel_
    Power Participant

    Hello Nidhi

    - checks if the relationship that exists has the columns in the same date format,

    - you are using hours in the date?

    - share an example and the format of the relationship columns

     

    Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! ;-
    Best Regards
    BC

      • onurbmiguel_'s avatar
        onurbmiguel_
        Power Participant

        Hi again, 

        need some example to analize 

         

        Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! ;-
        Best Regards
        BC

  • onurbmiguel_'s avatar
    onurbmiguel_
    Power Participant

    Hi again, 

    At least can you share your measure? 

     

    Did I answer your question? Mark my post as a solution! Appreciate your Kudos!! ;-
    Best Regards
    BC

    • NidhiBhusari's avatar
      NidhiBhusari
      Helper IV

      PY Sales --> CALCULATE(SUM(SALES), SAMEPERIODLASTYEAR(DATESYTD(CALENDAR(Date)))).
      CY Sales --> CALCULATE(SUM(SALES), DATESYTD(CALENDAR(Date)))