Forum Discussion

Suhel_Ansari's avatar
Suhel_Ansari
Icon for Helper V rankHelper V
1 year ago
Solved

3 months Total DAX Measure

Hi All,

I need a Measure to calcualte the 3 Months total as shonw in follwoing screen print. please assit. Thanks

Ex : - Jan,Fab & Mar total shown be the 3 Months accross Jan,Feb & Mar (1598+1735+1659) = 4992 etc...

 

 

  • Hi Suhel_Ansari ,

    Please use this DAX to achieve your goal:

    QuarterlyTotal = 
    VAR CurrentQuarter = QUARTER(MAX('Table'[Edate]))
    VAR CurrentYear = YEAR(MAX('Table'[Edate]))
    RETURN
    CALCULATE(
        SUM('Table'[Saless]),
        FILTER(
            ALL('Table'),
            YEAR('Table'[Edate]) = CurrentYear &&
            QUARTER('Table'[Edate]) = CurrentQuarter
        )
    )

     

    Your final result will look like this:

     

4 Replies

  • Hi Suhel_Ansari ,

    Please use this DAX to achieve your goal:

    QuarterlyTotal = 
    VAR CurrentQuarter = QUARTER(MAX('Table'[Edate]))
    VAR CurrentYear = YEAR(MAX('Table'[Edate]))
    RETURN
    CALCULATE(
        SUM('Table'[Saless]),
        FILTER(
            ALL('Table'),
            YEAR('Table'[Edate]) = CurrentYear &&
            QUARTER('Table'[Edate]) = CurrentQuarter
        )
    )

     

    Your final result will look like this:

     

    • Tahreem24's avatar
      Tahreem24
      Icon for Super User rankSuper User

      Suhel_Ansari  I recommend uzuntasgokberk solution for your case if you have multiple years. 

      Otherwise try this DAX: (This only works for one year period as per your given data)

      Measure 2 = CALCULATE(SUM('Table'[Sale]),FILTER(ALLSELECTED('Table'),QUARTER('Table'[Edate])<=QUARTER(MAX('Table'[Edate]))))

       



  • Hello Suhel_Ansari ,

    Could you try below the dax code:
    "
    Total 3-Months  =
    CALCULATE(
    SUM('YourTable'[Sales]),
    FILTER(
    ALL('YourTable'[Date]),
    YEAR('YourTable'[Date]) = YEAR(MAX('YourTable'[Date])) &&
    QUARTER('YourTable'[Date]) = QUARTER(MAX('YourTable'[Date]))
    )
    )
    "

     

    Kind Regards,
    Gökberk Uzuntaş

    📌 If this post helps, then please consider Accepting it as a solution and giving Kudos — it helps other members find answers faster!

    🔗 Stay Connected:
    📘 Medium |
    📺 YouTube |
    💼 LinkedIn |
    📷 Instagram |
    🐦 X |
    👽 Reddit |
    🌐 Website |
    🎵 TikTok |