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.
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?
Solved! Go to Solution.
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"))
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.
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"))
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.
@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_id | userid | va_id | vs_id |
1 | 773136 | 183214 | 1 |
1 | 794932 | 183214 | 1 |
1 | 817108 | 183214 | 1 |
1 | 821572 | 183214 | 1 |
1 | 876498 | 183214 | 1 |
1 | 876702 | 183214 | 1 |
1 | 877171 | 183214 | 1 |
1 | 877244 | 183214 | 1 |
1 | 877390 | 183214 | 1 |
1 | 877971 | 183214 | 1 |
1 | 879176 | 183214 | 1 |
1 | 879815 | 183214 | 1 |
1 | 879874 | 183214 | 1 |
1 | 880028 | 183214 | 1 |
1 | 880700 | 183214 | 1 |
1 | 880706 | 183214 | 1 |
1 | 881462 | 183214 | 1 |
1 | 881471 | 183214 | 1 |
1 | 881586 | 183214 | 1 |
1 | 881853 | 183214 | 1 |
2 | 773136 | 183214 | 2 |
2 | 794932 | 183214 | 2 |
2 | 817108 | 183214 | 2 |
2 | 821572 | 183214 | 2 |
2 | 876498 | 183214 | 2 |
2 | 876702 | 183214 | 2 |
2 | 877171 | 183214 | 2 |
2 | 877244 | 183214 | 2 |
2 | 877390 | 183214 | 2 |
2 | 877971 | 183214 | 2 |
2 | 879176 | 183214 | 2 |
2 | 879815 | 183214 | 2 |
2 | 879874 | 183214 | 2 |
2 | 880028 | 183214 | 2 |
2 | 880700 | 183214 | 2 |
2 | 880706 | 183214 | 2 |
2 | 881462 | 183214 | 2 |
3 | 881471 | 183214 | 3 |
3 | 881586 | 183214 | 3 |
4 | 881853 | 183214 | 4 |
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
39 | |
20 | |
19 | |
16 | |
15 |
User | Count |
---|---|
49 | |
26 | |
22 | |
17 | |
16 |