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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.