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
mousumimandal
Regular Visitor

Count and percentage of a subcategory of a category

I have these data in an excel

Priority

SLA Breached

Number

P1

Yes

INC0000

P2

No

INC0001

P3

Yes

INC0002

P3

No

INC0003

P4

No

INC0004

P4

No

INC0005

P5

Yes

INC0006

P5

Yes

INC0007


and I want output as below in power BI table format. Any help will be appreciated

 

Priority

Total tickets

% of No

P1

1

0

P2

1

100

P3

2

50

P4

2

100

P5

2

0

2 ACCEPTED SOLUTIONS
barritown
Super User
Super User

Hi @mousumimandal,

You can try this option:

barritown_0-1706731783057.png

DAX code in plain text:

Result Table = 
    ADDCOLUMNS (
        SUMMARIZE ( 'Table', [Priority], "Total tickets", CALCULATE ( COUNTROWS ( 'Table' ) ) ),
        "% of No", 
        VAR currentPriority = [Priority]
        RETURN FORMAT ( ( COUNTROWS ( FILTER ( 'Table', [SLA Breached] = "No" && [Priority] = currentPriority ) ) + 0 ) / [Total tickets], "Percent" ) )

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

 

View solution in original post

Hi @mousumimandal,

 

Try removing the FORMAT (...) part and updating settings (see the screenshot below). Should work after that.

 

barritown_0-1706904491013.png

 

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

View solution in original post

4 REPLIES 4
barritown
Super User
Super User

Hi @mousumimandal,

You can try this option:

barritown_0-1706731783057.png

DAX code in plain text:

Result Table = 
    ADDCOLUMNS (
        SUMMARIZE ( 'Table', [Priority], "Total tickets", CALCULATE ( COUNTROWS ( 'Table' ) ) ),
        "% of No", 
        VAR currentPriority = [Priority]
        RETURN FORMAT ( ( COUNTROWS ( FILTER ( 'Table', [SLA Breached] = "No" && [Priority] = currentPriority ) ) + 0 ) / [Total tickets], "Percent" ) )

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

 

Thank you, It worked. There was another thing
I was trying to change the background colour of "% of No". but its not showing me generic option like this.

mousumimandal_1-1706870529154.png

 


Instead, I am getting count, sum etc.

mousumimandal_0-1706870390794.png

 

Hi @mousumimandal,

 

Try removing the FORMAT (...) part and updating settings (see the screenshot below). Should work after that.

 

barritown_0-1706904491013.png

 

Best Regards,

Alexander

My YouTube vlog in English

My YouTube vlog in Russian

Thanks. It worked😀

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.