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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Creating a KPI based on pivot table

Hi all,

I want to create a KPI which gives me the total number of 'house_id' where the 'number_of_cars' is greater than 4.

I have created a "pivot visual" in powerbi which looks something like this:

 

House_idHouse_NameCount_number_of_cars
111222Tony10
222111Sarah8
111333Dave6
123456Tom6
234567Rajan5
345678Roshan15
456789Wazza4
567123Ronaldo3
234987Messi3
987456House102
765432Akali1
543216Ekko1

 

The "count_number_of_cars" column is essentially a count of the number of cars each house owns, and the pivot visual is grouping this by "house_id".

I have not created any additional measures or columns here, but i'm finding it hard to create a KPI which tells me the number of records/houses that have more than 4 cars for example as I dont have a single field I can put in the KPI. 

How would I achieve this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@parry2k Thanks for suggesting the formula, it didn't work quite as well but i did look into the function and came up with this measure which seems to work:

 

carcount =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            house,
            [house_id],
            "count", DISTINCTCOUNT ( [number_of_cars] )
        ),
        [count] > 1
    )
)

Is there a way to make this measure interact with my other graphs/tables? For e.g. If this measure tells me the total number of homes with more than 4 cars is 20 homes, then I want my other visuals to filter for these specific 20 homes....if that makes sense?

View solution in original post

2 REPLIES 2
parry2k
Super User
Super User

@Anonymous add a measure to count houses with more than equal to 4 cars:

 

KPI More than 4 cars = 
SUMX (
   SUMMARIZE ( Table, Table[House_Id], "@Cars Count", COUNTROWS ( Table ) ),
   IF ( [@Cars Count] >= 4, 1 )
)

 

Check my latest blog post Comparing Selected Client With Other Top N Clients | PeryTUS  I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

@parry2k Thanks for suggesting the formula, it didn't work quite as well but i did look into the function and came up with this measure which seems to work:

 

carcount =
COUNTROWS (
    FILTER (
        SUMMARIZE (
            house,
            [house_id],
            "count", DISTINCTCOUNT ( [number_of_cars] )
        ),
        [count] > 1
    )
)

Is there a way to make this measure interact with my other graphs/tables? For e.g. If this measure tells me the total number of homes with more than 4 cars is 20 homes, then I want my other visuals to filter for these specific 20 homes....if that makes sense?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.