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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

DAX Measure Assistance

I am looking to create a measure that will return the min value of a filtered group.

 

The group currently is a support table and has no direct relationships with any of the tables.RelationshipsRelationships

 

 The measure to obtain the grouping is as follows - 

 

Total Reading Grouped by Site Size =
VAR RankingDim = VALUES ( Sites1[Site ID] )
RETURN
CALCULATE ( [Total Reading],
FILTER ( RankingDim,
COUNTROWS (
FILTER ( Size_Groupings,
IF ( NOT ( ISBLANK ( [Site Size] ) ),
RANKX ( ALL ( Sites1[Site ID] ), [Site Size],, DESC ) > Size_Groupings[Min]
&&

RANKX ( ALL ( Sites1[Site ID] ), [Site Size],, DESC ) <= Size_Groupings[Max],
BLANK () ) ) ) > 0 ) )

 

I would like to be able to use a slicer to select which group I am interested in and for the measure to display the min size in that particular group and the total reading for that site.

 

Desired Result: ResultResult

 

 The text boxes to the right of the slicer selection shows an example of the ask, and would change when the Group selected changed. I am not likely to use the text box to display the result, more likely to use the Card visual.

 

Link to PBIX file and Excel file - https://1drv.ms/u/s!ApGb04aQrU58i3Bj9ZntcmIHaVQ8?e=gwAs1S

 

Thanks in advance

 

2 ACCEPTED SOLUTIONS
PaulDBrown
Community Champion
Community Champion

@Anonymous 

 

See if this works:

 

Min Site size by Group =
MINX (
    SUMMARIZE (
        FILTER (
            ALL ( Sites1[Site ID] ),
            NOT ( ISBLANK ( [Total Reading Grouped by Site Size] ) )
        ),
        Sites1[Site ID],
        "size", [Site Size]
    ),
    [size]
)
Min Site ID by Group =
CALCULATE (
    MAX ( Sites1[Site ID] ),
    FILTER (
        ALLSELECTED ( Sites1[Site ID] ),
        [Min Site size by Group] = [Site Size]
    )
)
Total reading for Min Site ID by Group =
CALCULATE (
    [Total Reading],
    FILTER (
        ALLSELECTED ( Sites1[Site ID] ),
        [Min Site size by Group] = [Site Size]
    )
)
Min Site ID Text =
"Site ID " & [Min Site ID by Group] & " at "
    & FORMAT ( [Min Site size by Group], "Standard" ) & " sqft is the smallest store in this group with a total reading  of "
    & FORMAT ( [Total reading for Min Site ID by Group], "standard" )

 

I've included the sames calculations to obtain the max site values and text in the attached PBIX file:

result.JPG

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

@Anonymous 

try:

MINX(FILTER (
ALLSELECTED ( Sites1[Site ID] ),
[Min Site size by Group] = [Site Size]
),

[Total reading])





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

5 REPLIES 5
PaulDBrown
Community Champion
Community Champion

@Anonymous 

 

See if this works:

 

Min Site size by Group =
MINX (
    SUMMARIZE (
        FILTER (
            ALL ( Sites1[Site ID] ),
            NOT ( ISBLANK ( [Total Reading Grouped by Site Size] ) )
        ),
        Sites1[Site ID],
        "size", [Site Size]
    ),
    [size]
)
Min Site ID by Group =
CALCULATE (
    MAX ( Sites1[Site ID] ),
    FILTER (
        ALLSELECTED ( Sites1[Site ID] ),
        [Min Site size by Group] = [Site Size]
    )
)
Total reading for Min Site ID by Group =
CALCULATE (
    [Total Reading],
    FILTER (
        ALLSELECTED ( Sites1[Site ID] ),
        [Min Site size by Group] = [Site Size]
    )
)
Min Site ID Text =
"Site ID " & [Min Site ID by Group] & " at "
    & FORMAT ( [Min Site size by Group], "Standard" ) & " sqft is the smallest store in this group with a total reading  of "
    & FORMAT ( [Total reading for Min Site ID by Group], "standard" )

 

I've included the sames calculations to obtain the max site values and text in the attached PBIX file:

result.JPG

 





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

PaulDBrown, thanks for your help in this.

 

Can I ask is there a way to only return a single value for the measure - 
Total reading for Min Site ID by Group =
CALCULATE (
[Total Reading],
FILTER (
ALLSELECTED ( Sites1[Site ID] ),
[Min Site size by Group] = [Site Size]
)
)

When there are two sites with identical sizes, the [Total Reading] returns the values summed.

@Anonymous 

try:

MINX(FILTER (
ALLSELECTED ( Sites1[Site ID] ),
[Min Site size by Group] = [Site Size]
),

[Total reading])





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

Hi VijayP. Sorry I maybe didn't explain properly. The measure I posted shows how I calculate the groups and not the measure to bring back the min values. 

 

I don't have an example of what I have attempted so far to obtain the single min value for the selected group.

VijayP
Super User
Super User

@Anonymous 

RANKX ( ALL ( Sites1[Site ID] ), [Site Size],, DESC ) > Size_Groupings[Min]
&&

RANKX ( ALL ( Sites1[Site ID] ), [Site Size],, DESC ) <= Size_Groupings[Max]

 

Change > to >=

and 

Change <= to <  and let me know whether you get desired result 




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.