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
paulvans182
Helper III
Helper III

IF Statement List based on measure results

Good afternoon,

 

I have the following calculation

 

Match Up Count Rows = CALCULATE(COUNTROWS('Game Fact'),FILTER('Game Fact','Game Fact'[Game Board]IN ALLSELECTED('Game Fact'[Game Board])))

 

 

If I place that measure in a table with Game ID, I get the following:

 Match Up Game Id Count.PNG

Is there a way that I can store the Game IDs where the Result is equal to 22 into a variable?  I would then like to be able to use that variable as part of a FILTER component for further CALCULATE expressions?

 

Kind regards,

Paul

1 ACCEPTED SOLUTION
AntrikshSharma
Community Champion
Community Champion

You could use something like this, also you can replace the whole FILTER with KEEPFILTERS and ALLSELECTED.

Match Up Count Rows =
VAR Something =
    FILTER (
        VALUES ( GameID ),
        CALCULATE (
            COUNTROWS ( 'Game Fact' ),
            KEEPFILTERS ( ALLSELECTED ( 'Game Fact'[Game Board] ) )
        ) = 22
    )
RETURN
    Something

  

View solution in original post

3 REPLIES 3
AntrikshSharma
Community Champion
Community Champion

You could use something like this, also you can replace the whole FILTER with KEEPFILTERS and ALLSELECTED.

Match Up Count Rows =
VAR Something =
    FILTER (
        VALUES ( GameID ),
        CALCULATE (
            COUNTROWS ( 'Game Fact' ),
            KEEPFILTERS ( ALLSELECTED ( 'Game Fact'[Game Board] ) )
        ) = 22
    )
RETURN
    Something

  

This is brilliant, thank you so much.

 

Kind regards,

Paul

You're welcome! 🙂

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.