powerbidax

DAX filter a Measure by an other Measure


My current measure (that is depending on other measures) looks like this and does not work:

GNum Count Class 1 = 
    CALCULATE ( [Count Values Minus 0]
            , FILTER ( TableClass_Details, 
                        [GNum x AVG] = 1
                )
            )

All the following measures work fine.

I want to count all the accounts with the classification Average = 1.

GNum x AVG = ([Class Account Income] + [Class Account Size]) / 2

Class Account Income = SWITCH(TRUE(),
    SUMX(TableClass_Details, TableClass_Details[Income]) >= 10000,1,
    SUMX(TableClass_Details, TableClass_Details[Income]) >= 5000
    && SUMX(TableClass_Details, TableClass_Details[Income]) <= 9999,2,
    3)

My count values measure looks like this:

Count Values Minus 0 = 
CALCULATE(
    COUNTROWS(TableClass_Details)
    ,TableClass_Details[Income] > 0
    )

So I am using measures inside other measures. "GNum x AVG" works just fine but I am not able to count how many accounts have an average of 1 in my measure "GNum Count Class 1".
Please help me figure it out.
Here you can see the goal and some data:

enter image description here

Account,    Income, Size
A128,   100,    5000
A129,   7000,   400
A130,   20000,  15000
A131,   8020,   7000
A132,   15000,  10000
A133,   600,    15000
A134,   8000,   400
A135,   150,    200

Solution

  • you can try this

    Measure =
    SUMX ( VALUES ( TableClass_Details[Account] ), IF ( [GNum x AVG] = 2, 1 ) )
    

    enter image description here