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
MungBurger
Helper I
Helper I

Rolling 12 month min / max

I have this DAX that works in DAX Studio and returns the expected value.

 

DEFINE 
VAR DateFilter =   FILTER(
    KEEPFILTERS(VALUES('DIM Date'[Full Date])),
    AND(   'DIM Date'[Full Date] >= DATE(2019, 1, 1),
      'DIM Date'[Full Date] < DATE(2020, 1, 1)    )  )

var tbl =   TOPN(    100,
    SUMMARIZECOLUMNS(
      'DIM Date'[Month Year Short Description],     
      DateFilter
      ,"A1", [Availability]    )  )

VAR R = GROUPBY ( tbl,     
 "A2", MAXX( CURRENTGROUP(), [A1])  )

EVALUATE
R

 

I'm wanting the measure to look back 12 months and return the maximum monthly value in that period.

 

When the expression is created in SSAS Tabular Cube or Power BI (after replacing Evaluate with return)  I get this error message.

SummarizeColumns() and AddMissingItems() may not be used in this context.

 

Any help on how to rewrite this, as a single measure that will work, would be greatly appreciated, thanks.


1 ACCEPTED SOLUTION

Hi,

You may download my revised PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

13 REPLIES 13

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.