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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
rob_vander2
Helper II
Helper II

DAX for passing filter context to dimension from measure

I have below data with columns ID,Number & Name. I want to count the distinct IDs for maximum Number value. I am using below DAX in KPI which works fine
calculate( distinctcount(Table[ID], Table[Number]=max(Table[Number]))

 

But, I want to pass the condition of measure to table visual where there is other dimension. 

 

I have provided Number as filter. If no filter is selected table visual should be filtered for max Number. If I select any other value from Number, table visual should filter based on that selection. Please see the attached screenshot of requirement

Screenshot 2025-05-02 at 16.35.02.png

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

You could create a measure like

Row is visible =
VAR MaxNumber =
    CALCULATE ( MAX ( 'Table'[Number] ), REMOVEFILTERS () )
VAR CurrentNumber =
    SELECTEDVALUE ( 'Table'[Number] )
VAR Result =
    IF (
        (
            NOT ( ISFILTERED ( 'Table'[Number] ) )
                && CurrentNumber = MaxNumber
        )
            || ISFILTERED ( 'Table'[Number] ),
        1
    )
RETURN
    Result

Add this as a filter to the table visual and set it to show only when the value is 1

View solution in original post

6 REPLIES 6
v-sdhruv
Community Support
Community Support

Hi @rob_vander2 ,
Just wanted to check if you had the opportunity to review the suggestion provided?
If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank You

v-sdhruv
Community Support
Community Support

Hi @rob_vander2 ,
Just wanted to check if you had the opportunity to review the suggestion provided?
If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank You

v-sdhruv
Community Support
Community Support

Hi @rob_vander2 ,
Just wanted to check if you had the opportunity to review the suggestion provided?
If the response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank You

johnt75
Super User
Super User

You could create a measure like

Row is visible =
VAR MaxNumber =
    CALCULATE ( MAX ( 'Table'[Number] ), REMOVEFILTERS () )
VAR CurrentNumber =
    SELECTEDVALUE ( 'Table'[Number] )
VAR Result =
    IF (
        (
            NOT ( ISFILTERED ( 'Table'[Number] ) )
                && CurrentNumber = MaxNumber
        )
            || ISFILTERED ( 'Table'[Number] ),
        1
    )
RETURN
    Result

Add this as a filter to the table visual and set it to show only when the value is 1

rob_vander2
Helper II
Helper II

@lbendlin  can you explain why it's not possible?

lbendlin
Super User
Super User

Not possible within the same table. You need to use a disconnected table for the Number slicer.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

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.