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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
E5254730
Frequent Visitor

Need help to calculate Percentage

Hello,

See below table for your reference.

 

E5254730_0-1684943229235.png

1. Remove Blanks from the Date Column

2. Remove Blanks from the Amount Column

3. Count total Status. In this case it is 10.

 

Now I need to calculate percentage to get result as 70%. In this case it will be Total 10 divided by Active (7).

Total Status count is 10 of which 7 are Active status.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @E5254730 ,

Plese try below dax formula:

Measure = 
VAR TMP =
    FILTER (
        ALL ( 'Table' ),
        [Amount] <> BLANK ()
            && [Date] <> BLANK ()
            
    )
VAR _A =
    COUNTROWS ( TMP )
VAR _B =
    COUNTROWS ( FILTER ( TMP, [Status] = "Active" ) )
RETURN
    DIVIDE ( _B, _A )

vbinbinyumsft_0-1685428115353.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @E5254730 ,

Please try below steps:
1. below is my test table

Table:

vbinbinyumsft_0-1685086655610.png

2. cretae  a measure with below dax formula

Measure =
VAR TMP =
    FILTER (
        ALL ( 'Table' ),
        [Amount] <> BLANK ()
            && [Date] <> BLANK ()
            && [Satus] <> BLANK ()
    )
VAR _A =
    COUNTROWS ( TMP )
VAR _B =
    COUNTROWS ( FILTER ( TMP, [Satus] = "Active" ) )
RETURN
    DIVIDE ( _B, _A )

vbinbinyumsft_1-1685086748954.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Anonymous ,

When we change few of the Dates (month) it shows 70% for all the months.

See below screen shot. Could not see an option to attach .pbix file.

 

E5254730_0-1685088244280.png

 

Anonymous
Not applicable

Hi @E5254730 ,

Please try to use card visual.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Anonymous ,

My new data is structured as below. Have added new months i.e. Jan to Dec.

E5254730_0-1685106850890.png

 

My old data had only one date i.e. May 24th 2023.

Anonymous
Not applicable

Hi @E5254730 ,

Plese try below dax formula:

Measure = 
VAR TMP =
    FILTER (
        ALL ( 'Table' ),
        [Amount] <> BLANK ()
            && [Date] <> BLANK ()
            
    )
VAR _A =
    COUNTROWS ( TMP )
VAR _B =
    COUNTROWS ( FILTER ( TMP, [Status] = "Active" ) )
RETURN
    DIVIDE ( _B, _A )

vbinbinyumsft_0-1685428115353.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

miTutorials
Super User
Super User

Please see the below tutorial and tweak the logic a bit to achieve what you want to.

 

Count Rows or Sum Columns based on single or Multiple conditions in PowerBI | MiTutorials - YouTube

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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