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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Create a boolean KPI based on categorical variable

Hi,

 

 Posting a subset of my dataset that looks like this:

 

Product CodeType
abc1Type1
abc1Type2
abc2Type1
abc3Type2
abc5Type1
abc5Type2
abc7Type1
abc8Type2
abc8Type1
abc10Type2
abc11Type1
abc11Type2
abc13Type1

 

In my report, I have a filter on the column Product code. 1 value can be selected at a time.

I want 2 KPIs called "Type1 "and "Type2"  which says "Yes" or "No"

 

The logic for KPI: If for a product code, there exists Type1 then "Type" 1 KPI says "Yes" else it says "No". Same logic for "Type2" KPI

 

2 Examples:

Product Code abc1
Type1Type2
YesYes
  
Product Code abc2
Type1Type2
YesNo

 

Note: A product code can be Type1 or Type 2 or both.

1 ACCEPTED SOLUTION
TeigeGao
Solution Sage
Solution Sage

Hi @Anonymous ,

There is not a visual can display like your example, we can use multiple visual to display it, we cna create three measures to display these data:

Measure = IF(CALCULATE(MIN(Table1[Type]),FILTER(ALL(Table1),Table1[Product Code] = SELECTEDVALUE(Table1[Product Code]) && Table1[Type] = "Type1")) = BLANK(),"No","Yes")
Measure 2 = SELECTEDVALUE(Table1[Product Code])
Measure 3 = IF(CALCULATE(MIN(Table1[Type]),FILTER(ALL(Table1),Table1[Product Code] = SELECTEDVALUE(Table1[Product Code]) && Table1[Type] = "Type2")) = BLANK(),"No","Yes")

The result will like below:

mE5wdRg9fg.gif

Best Regards,

Teige

View solution in original post

1 REPLY 1
TeigeGao
Solution Sage
Solution Sage

Hi @Anonymous ,

There is not a visual can display like your example, we can use multiple visual to display it, we cna create three measures to display these data:

Measure = IF(CALCULATE(MIN(Table1[Type]),FILTER(ALL(Table1),Table1[Product Code] = SELECTEDVALUE(Table1[Product Code]) && Table1[Type] = "Type1")) = BLANK(),"No","Yes")
Measure 2 = SELECTEDVALUE(Table1[Product Code])
Measure 3 = IF(CALCULATE(MIN(Table1[Type]),FILTER(ALL(Table1),Table1[Product Code] = SELECTEDVALUE(Table1[Product Code]) && Table1[Type] = "Type2")) = BLANK(),"No","Yes")

The result will like below:

mE5wdRg9fg.gif

Best Regards,

Teige

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.