cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kebas_Leech
Frequent Visitor

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 LineProduct TypePerf_Shift
1type x1st
1type y1st
1type z1st
2type y2nd

 

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:

 

ShiftCount
1st3
2nd1

 

Thank you!

 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
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...



!! Microsoft Fabric !!
Microsoft Power BI Learning Resources, 2023 !!
Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!

View solution in original post

tamerj1
Super User
Super User

Hi @Kebas_Leech 

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 )
)

View solution in original post

3 REPLIES 3
Kebas_Leech
Frequent Visitor

Both replies helped. Thank you so much!

tamerj1
Super User
Super User

Hi @Kebas_Leech 

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 )
)
amitchandak
Super User
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...



!! Microsoft Fabric !!
Microsoft Power BI Learning Resources, 2023 !!
Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!

Helpful resources

Announcements
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors