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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

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
May PBI 25 Carousel

Power BI Monthly Update - May 2025

Check out the May 2025 Power BI update to learn about new features.

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

May 2025 Monthly Update

Fabric Community Update - May 2025

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