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
Anonymous
Not applicable

Count the number of times a measure breaches certain thresholds

Hi,

I have a measure called “rate” which is using Calculate and filter to return a % against each type.

 

Type

Rate

A

0.50%

B

0.20%

C

1.10%

D

0.00%

E

0.00%

F

0.00%

G

0.00%

H

0.00%

I

1.30%

J

0.00%

K

0.00%

 

But what I really need is a summary table which returns the number of times the rate falls into each “bin” below, and without showing the Type in a row.

 

<0.4%

>0.4%

>1%

8

1

2

 

I have tried a few methods but no luck so far – any help most appreciated!

 

1 ACCEPTED SOLUTION

Hi @Anonymous 

Create measures and add measures to table visual, it would be dynamic with the selection from slicers.

Capture4.JPG

rate =
CALCULATE (
    SUM ( 'Table'[d] ),
    FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Type] = MAX ( 'Table'[Type] ) )
)
    / CALCULATE (
        SUM ( 'Table'[v] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Type] = MAX ( 'Table'[Type] ) )
    )

round_up = ROUNDUP([rate],4)

<0.4% = CALCULATE(DISTINCTCOUNT('Table'[Type]),FILTER('Table',[round_up]<=0.004))

>1% = CALCULATE(DISTINCTCOUNT('Table'[Type]),FILTER('Table',[round_up]>=0.01))

0.4%~1% = CALCULATE(DISTINCTCOUNT('Table'[Type]),FILTER('Table',[round_up]>=0.004&&[round_up]<0.01))
Best Regards
Maggie
Community Support Team _ Maggie Li
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

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

It is impossible to group by a measure.

Please change the measure to a caluclated column.

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi,

 

The measure "Rate" is a ratio, so it can't go in a calculated column because it cannot be aggregated.

 

I guess the only way is to create some kind of summarised table where the "Rate" has already been calculated at the required category level.

Hi @Anonymous 

Create measures and add measures to table visual, it would be dynamic with the selection from slicers.

Capture4.JPG

rate =
CALCULATE (
    SUM ( 'Table'[d] ),
    FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Type] = MAX ( 'Table'[Type] ) )
)
    / CALCULATE (
        SUM ( 'Table'[v] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Type] = MAX ( 'Table'[Type] ) )
    )

round_up = ROUNDUP([rate],4)

<0.4% = CALCULATE(DISTINCTCOUNT('Table'[Type]),FILTER('Table',[round_up]<=0.004))

>1% = CALCULATE(DISTINCTCOUNT('Table'[Type]),FILTER('Table',[round_up]>=0.01))

0.4%~1% = CALCULATE(DISTINCTCOUNT('Table'[Type]),FILTER('Table',[round_up]>=0.004&&[round_up]<0.01))
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.