Forum Discussion

sammy02hk's avatar
sammy02hk
Icon for Helper I rankHelper I
3 years ago
Solved

Modifying DAX Code for retrieve full data

Hi there,

Below is the sum of Sales with 

LLM last last month, LM Last Month, TM This Month

Hope my result like:

1st approach:

Right now i can retrieve the result by selecting Billing Month. 

Without selecting Billing Month Error Message: A table of multiple values was supplied where a single value was expected

 

2nd approach:

Its not working since i have to use month as one of my parameter.

 

How can I modify the code so that I can have a full picture without selecting Month.

 

Thank you for your help.

 

Sammy Chu

  • mSale:=SUM(Sales[sale])

    mSalesLM:=CALCULATE([mSale],PARALLELPERIOD('Calendar'[Date],-1,MONTH))

    mSalesLLM:=CALCULATE([mSale],PARALLELPERIOD('Calendar'[Date],-2,MONTH))

     

6 Replies

  • hi sammy02hk 

    try like:

    ...
    var LLMonth - DATEADD(MAX(Monthly_All[Billing_Month]),-2,MONTH)
    ...

  • mSale:=SUM(Sales[sale])

    mSalesLM:=CALCULATE([mSale],PARALLELPERIOD('Calendar'[Date],-1,MONTH))

    mSalesLLM:=CALCULATE([mSale],PARALLELPERIOD('Calendar'[Date],-2,MONTH))

     

    • sammy02hk's avatar
      sammy02hk
      Icon for Helper I rankHelper I

      Hi RichardOfSydney ,

      Thank you for your help.
      But the LLM get the same result with This month.

      Cheers,

      Sammy Chu