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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.