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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Calculate occurence based on multiple colomns filters

Hi Team 

 

I have below dataset: 

 

CityValue1Value2
DelhiYes 
DelhiNoNa
DelhiNoYes
DelhiNANo
MumbaiYesNo
MumbaiYesNo
MumbaiNoNA
MumbaiNoNA
BangaloreYesna
Bangalorenona
BangaloreNo 
BangalorenoYes

 

I want to return below output in a card visual using measure :

 

No of locations where Value1 and value2 is Yes , output would be 2 here

Delhi and Bangalore has Value1 and Value2 Yes where mumbai has Value 1 yes but no rows has value2 as yes.

 

@Greg_Deckler @tamerj1 @johnt75 @Jihwan_Kim @Wilson_ 

1 ACCEPTED SOLUTION

hi @Anonymous 

the data is exactly from you and i only name it as data. all others are included in the previous replies. 

View solution in original post

6 REPLIES 6
FreemanZ
Super User
Super User

hi @Anonymous 

try to plot a card visual with a measure like:

Measure = 
VAR _table = 
    ADDCOLUMNS(
        VALUES(Data[City]),
        "Value1",
        CALCULATE(MAX(Data[Value1])),
        "Value2",
        CALCULATE(MAX(Data[Value2]))
    )
RETURN
    COUNTROWS(
        FILTER(
            _table,
            [Value1]="Yes"&&[Value2]="Yes"
        )
    )

it worked like:

FreemanZ_0-1682337369464.png

Anonymous
Not applicable

Thank you for the promt response unfortunately its not working. I just gave dummy data but Value1 and value2 has other data apart from NA, No so Max fucntion is capturing those values instead Yes.

 

how to explicit call Yes as Max fucntion giving some other output

 

@FreemanZ 

hi @Anonymous 

then try like:

Measure = 
VAR _table = 
    GENERATE(
        VALUES(Data[City]),
        CALCULATETABLE(
            CROSSJOIN(VALUES(Data[Value1]), VALUES(Data[Value2]))
        )
    )
RETURN
    COUNTROWS(
        FILTER(
            _table,
            [Value1]="Yes"&&[Value2]="Yes"
        )
    )

 

it worked like:

FreemanZ_0-1682338595922.png

Anonymous
Not applicable

Can you please share the pbix if possible?  @FreemanZ 

hi @Anonymous 

the data is exactly from you and i only name it as data. all others are included in the previous replies. 

Anonymous
Not applicable

Its working, thanks buddy!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.