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
unnijoy
Post Partisan
Post Partisan

Creating table for finding number of people under certain catogery

I have a table with country name and employee ID.

When ever an employee is awarded the country name and employee id will be added to the table. I need to create a table which will show like below. How many people from Ind got awarded only 1 time, 2 time,3 time and more than 3 time. The logic we use is how many times the employee id is repeating. I haved attached sample data that i use to create the below table. Please help me how we can create it in powerbi

 

CountryOne timeTwo timesThree timesMore than three times
Ind0121
MAL0011
CHI1010

 

CountryEmpid
Ind123
Ind123
Ind123
Ind123
Ind234
Ind234
Ind234
ind12
ind12
ind12
MAL345
MAL345
MAL345
MAL546
MAL546
MAL546
MAL546
CHI12
CHI23
CHI23
CHI23

 

4 REPLIES 4
Greg_Deckler
Super User
Super User

I am not 100% that I am clear on this but I believe you want a diconnected table and a measure like below. See the attached PBIX file.

 

Measure = 
    VAR __Count =
        SWITCH(MAX('Categories'[Category]),
            "One time",COUNTROWS(FILTER(SUMMARIZE('Table',[Empid],"__Count",COUNTROWS('Table')),[__Count]=1)),
            "Two times",COUNTROWS(FILTER(SUMMARIZE('Table',[Empid],"__Count",COUNTROWS('Table')),[__Count]=2)),        
            "Three times",COUNTROWS(FILTER(SUMMARIZE('Table',[Empid],"__Count",COUNTROWS('Table')),[__Count]=3)),
            COUNTROWS(FILTER(SUMMARIZE('Table',[Empid],"__Count",COUNTROWS('Table')),[__Count]>3))
        )
RETURN
    IF(ISBLANK(__Count),0,__Count)

 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler 

Thanks for your help. Its working. Can you pleae help me to find the number if i am adding a catogery column in the same data. Than means we have to find how many people are awarded for 1 single catogery, 2 catogerys 3 catogerys. I am attaching the data and the expected table below.

CountryAwarded - one CategoryAwarded - 2 CategoriesAwarded - 3 CategoriesAwarded - 4 CategoriesAwarded - > 4 Categories
Ind20100
MAL 1 01
CH11000

 

CountryEmpidCat
Ind123a
Ind123a
Ind123b
Ind123c
Ind234a
Ind234a
Ind234a
ind12b
ind12b
ind12b
MAL345b
MAL345a
MAL345a
MAL546b
MAL546a
MAL546c
MAL546d
CHI12a
CHI23b
CHI23b
CHI23c

 

Hi Anyone can help with the above request please...

@amitchandak  can you please help me with the above.

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.