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

Filter function not working with MAX function

Hi All,

 

I want to calculate the latest outstanding value corresponding to some columns (eg: Age_profile , Status)  provided that the data is for whole of previous week and the file type is OS.

 

I'm using below measure to calculate the outstanding volume 

 

Latest Outstanding =
CALCULATE (
    SUM ( LatestWeek[Volume] ),
    FILTER (
        LatestWeek,
        LatestWeek[WEEK_Commencing_Date] = MAX ( LatestWeek[WEEK_Commencing_Date] )
    ),
    FILTER ( LatestWeek, LatestWeek[File_Type] = "OS" )
)
 
I'm getting wrong results when I'm using MAX function. But if I'm using below function I get right results but that hinders my task as I cannot get previous weeks' data.
 

 

Latest Outstanding =
CALCULATE (
    SUM ( LatestWeek[Volume] ),
    FILTER (
        LatestWeek[LatestWeekCheck]=1
    ),
    FILTER ( LatestWeek, LatestWeek[File_Type] = "OS" )
)
 
Here I've created another column to get the check the latest week . So it gets me data for latest week but no data for previous weeks. 
 
Can Anyone help me ? Thanks in advance 🙂
 
 
1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Measure works on visual level. In the first measure, you used filter(table), so the max() function wouldn't give you the max value for all table but only the max value for the row. You can create a single measure like maxvalue = max(table[column]) to check.

1.PNG

In that case you may use ALLSELECTED() or ALL() function like below.

2.PNG

In addition, It's better to share some sample data to us so that we can deal with the DAX for you.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

1 REPLY 1
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Measure works on visual level. In the first measure, you used filter(table), so the max() function wouldn't give you the max value for all table but only the max value for the row. You can create a single measure like maxvalue = max(table[column]) to check.

1.PNG

In that case you may use ALLSELECTED() or ALL() function like below.

2.PNG

In addition, It's better to share some sample data to us so that we can deal with the DAX for you.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

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.