cancel
Showing results for
Did you mean:
Helper I

## Countrows based on filtered measure type text

Hello Everyone,

I have been trying to solve this but i've been unsuccessful so far.

The following measure [perf_shift] calculates and prints in which shift i have the max performance, based on another measure [performance]:

``````VAR vals =
SUMMARIZE(
'Main_Table',
'Main_Table' [Shifts],
"Measure", [performance]
)
VAR measureMax = MAXX( vals, [performance] )
VAR perf_shift = CALCULATE(
MAXX(
FILTER( vals, [Measure] = measureMax ),
'Main_Table' [Shifts]
)
)

RETURN
perf_shift``````

Returns: (filter: Production Line and Product Type)

 Production Line Product Type Perf_Shift 1 type x 1st 1 type y 1st 1 type z 1st 2 type y 2nd

Now, what im trying to calculate is the total sum of 1st and 2nd shifts that I end up with based on the same filters.

Expected Result:

 Shift Count 1st 3 2nd 1

Thank you!

2 ACCEPTED SOLUTIONS
Super User

@Kebas_Leech , You need to do dynamic segmentation

Dynamic segmentation -Measure to Dimension conversion: https://youtu.be/gzY40NWJpWQ

Above is for single value what you need

range value example

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1...

Super User

you need first to creat a disconnected table that contains { "1st", "2nd" } let's call it Shifts which you're going to use in the visual

then use the following measure

``````Count =
SUMX (
SUMMARIZE ( 'Main_Table', 'Main_Table'[Production], 'Main_Table'[LineProduct] ),
IF ( [Perf_Shift] = MAX ( Shifts[Shift] ), 1 )
)``````
3 REPLIES 3
Helper I

Both replies helped. Thank you so much!

Super User

you need first to creat a disconnected table that contains { "1st", "2nd" } let's call it Shifts which you're going to use in the visual

then use the following measure

``````Count =
SUMX (
SUMMARIZE ( 'Main_Table', 'Main_Table'[Production], 'Main_Table'[LineProduct] ),
IF ( [Perf_Shift] = MAX ( Shifts[Shift] ), 1 )
)``````
Super User

@Kebas_Leech , You need to do dynamic segmentation

Dynamic segmentation -Measure to Dimension conversion: https://youtu.be/gzY40NWJpWQ

Above is for single value what you need

range value example

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1...

Announcements

#### Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

#### Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

#### Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

#### Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors