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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Previous month column in Direct Query mode

Hi All,

 

I can able to create previous day value in import mode but i couldn't able to perform rankx operation in direct query mode.

 

11.PNG

 

How to get previous month value in another column in direct query mode?

 

Thanks

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can use EDATE function to work on it. Please refer to the formula as below.

Measure = var a = EDATE(MAX('Product'[SalesDate]),-1)
return
CALCULATE(SUM('Product'[Quantity]),FILTER(ALL('Product'),'Product'[SalesDate] = a))

Capture.PNG

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

3 REPLIES 3
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can use EDATE function to work on it. Please refer to the formula as below.

Measure = var a = EDATE(MAX('Product'[SalesDate]),-1)
return
CALCULATE(SUM('Product'[Quantity]),FILTER(ALL('Product'),'Product'[SalesDate] = a))

Capture.PNG

 

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Have you checked this:

go to file->options and settings -> options under direct query, select "allow unrestricted measures"

 

Please go through the link below for more information :

 

https://blog.crossjoin.co.uk/2017/05/09/dax-functions-directquery-and-unrestricted-measures/

 

You can also try ranking them in TOPN Visual level filters or in the SQL Query itself.

 

Thanks,

Nishanth.

Anonymous
Not applicable

Hi @Anonymous ,

 

That options is not showing up for me.

 

go to file->options and settings -> options under direct query, select "allow unrestricted measures"

 

Thanks

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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