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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
sammy02hk
Helper I
Helper I

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:

sammy02hk_0-1676963046586.png

1st approach:

sammy02hk_0-1676961703391.png

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.

sammy02hk_0-1676963234321.png

 

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

 

Thank you for your help.

 

Sammy Chu

1 ACCEPTED SOLUTION
RichardOfSydney
Regular Visitor

mSale:=SUM(Sales[sale])

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

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

RichardOfSydney_0-1676968160499.png

 

View solution in original post

6 REPLIES 6
RichardOfSydney
Regular Visitor

mSale:=SUM(Sales[sale])

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

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

RichardOfSydney_0-1676968160499.png

 

Hi @RichardOfSydney ,

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

sammy02hk_0-1676968900203.png

Cheers,

Sammy Chu

Dont use the var, they are 3 distinct measures.

RichardOfSydney_0-1676969149529.png

 

@RichardOfSydney 
Its work, when the sum put back. Thank you very much

sammy02hk_0-1676969073069.png

 

FreemanZ
Super User
Super User

hi @sammy02hk 

try like:

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

Hi @FreemanZ 
Thank you for your help. I got the below error message.

sammy02hk_0-1676962894907.png

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors