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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Super User
Super User

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
Super User
Super User

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.