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
evvxp13
Regular Visitor

Max Value with condition in direct mode

Hi,

've attaced a smple report and need to fetch the status of the max Date under each Cat and under each ID.

 

We are using Direct query mode to get this query.

 

 

https://docs.google.com/spreadsheets/d/1guuFBOtL0HZ9V_nd3Ml7ww0I4AYh21Rd/edit?usp=sharing&ouid=11018... 

 

Please let me know if you need frther details

 

Regards.

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

Hi, @evvxp13 ;

It is not recommended to create a column in DQ mode because there are many restrictions. You are advised to create a measure as follows:

Measure = CALCULATE(MAX('Table_6'[Status]),FILTER(ALL('Table_6'),[ID]=MAX('Table_6'[ID])&&[CAT]=MAX('Table_6'[CAT])))

The final output is shown below:

vyalanwumsft_0-1637566162464.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-yalanwu-msft
Community Support
Community Support

Hi, @evvxp13 ;

It is not recommended to create a column in DQ mode because there are many restrictions. You are advised to create a measure as follows:

Measure = CALCULATE(MAX('Table_6'[Status]),FILTER(ALL('Table_6'),[ID]=MAX('Table_6'[ID])&&[CAT]=MAX('Table_6'[CAT])))

The final output is shown below:

vyalanwumsft_0-1637566162464.png

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@evvxp13 , Try a measure like

measure =
var _max = maxx(filter(allselected(Table), Table[ID] = max(Table[ID]) && Table[status] = Max(Table[Status])), Table[Date])
return
maxx(filter(allselected(Table), Table[ID] = max(Table[ID]) && Table[status] = Max(Table[Status]) && Table[Date =_max), Table[Status])

Hi,

 

Actually i need a new calculated column or measure beside status as master status and the logic should work there?

 

Please advise.

 

REgards

@evvxp13 , I doubt this kind of logic can work for calculated columns in case of a direct query.

 

Meausre can

Could you help me with logic to create a calculated column

 Could be calcuated column or measure but as per the dataset i've attached, need to capture the final status based on above conditions at row level.

 

Regards

Appreciate your help.. tried multiple ways but dint work

 

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.