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
KA95
Helper III
Helper III

Counting and getting the total % of the greater than value

Hi there,

I want to create a measure that counts an ID value and checks if the ID value is greater than 1, if it's greater than 1 then get the % total. 

the id value is called uk_id in [tablename]. Is there a way that a measure can count the number of rows, then calculate how many are greater than 1 compared to 1 which then shows a % total? 

1 ACCEPTED SOLUTION
v-rongtiep-msft
Community Support
Community Support

Hi @KA95 ,

Please refer to my pbix file to see if it helps you.

Create a measure.

Measure =
VAR _count =
    CALCULATE ( COUNTROWS ( 'vs_id data' ), ALL ( 'vs_id data' ) )
VAR _countnot1 =
    CALCULATE (
        COUNT ( 'vs_id data'[vs_id] ),
        FILTER ( ALL ( 'vs_id data' ), 'vs_id data'[vs_id] > 1 )
    )
VAR _divide = _countnot1 / _count
RETURN
    IF ( MAX ( 'vs_id data'[vs_id] ) = 1, MAX ( 'vs_id data'[vs_id] ), FORMAT(_divide,"Percent"))

vpollymsft_0-1656556500285.png

If I have misunderstood your meaning, please provide more details with your deisred output( Preferably output in image form with text explanation).

 

Best Regards

Community Support Team _ Polly

 

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

4 REPLIES 4
v-rongtiep-msft
Community Support
Community Support

Hi @KA95 ,

Please refer to my pbix file to see if it helps you.

Create a measure.

Measure =
VAR _count =
    CALCULATE ( COUNTROWS ( 'vs_id data' ), ALL ( 'vs_id data' ) )
VAR _countnot1 =
    CALCULATE (
        COUNT ( 'vs_id data'[vs_id] ),
        FILTER ( ALL ( 'vs_id data' ), 'vs_id data'[vs_id] > 1 )
    )
VAR _divide = _countnot1 / _count
RETURN
    IF ( MAX ( 'vs_id data'[vs_id] ) = 1, MAX ( 'vs_id data'[vs_id] ), FORMAT(_divide,"Percent"))

vpollymsft_0-1656556500285.png

If I have misunderstood your meaning, please provide more details with your deisred output( Preferably output in image form with text explanation).

 

Best Regards

Community Support Team _ Polly

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

SpartaBI
Community Champion
Community Champion

@KA95 hey, can you share a sample data (copy paste a table here) and the write the desired result and the logic and I will write you back with the DAX measure

Hi @SpartaBI here is a sample dataset below, this mimmicks the exact table columns that I'm working with, the only important column, however, is the vs_id column. 

pl_iduseridva_idvs_id
17731361832141
17949321832141
18171081832141
18215721832141
18764981832141
18767021832141
18771711832141
18772441832141
18773901832141
18779711832141
18791761832141
18798151832141
18798741832141
18800281832141
18807001832141
18807061832141
18814621832141
18814711832141
18815861832141
18818531832141
27731361832142
27949321832142
28171081832142
28215721832142
28764981832142
28767021832142
28771711832142
28772441832142
28773901832142
28779711832142
28791761832142
28798151832142
28798741832142
28800281832142
28807001832142
28807061832142
28814621832142
38814711832143
38815861832143
48818531832144

 

Edit: Sorry I'm not sure why the table is formatting the way it is (so close together)

Here is the link to download the file if that's easier https://drive.google.com/file/d/1xapK-sJsXv7R2WEA-IoTFht4qgN1KjwO/view?usp=sharing

 

SpartaBI
Community Champion
Community Champion

@KA95 I pm you now

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.

Top Solution Authors