Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Hopeisgood1
Resolver I
Resolver I

How do I group (count) all the incident tickets with a multiple values in a column?

I have quite a bit of tickets that have multiple values in a column that are not in any order. Yet, I can't group these as 'Multiple HPs Selected'. 

 

You can see in the snapshot that the tickets with single select of HP are counted just fine but the ones in the smaller data numbers have the multiple values, I need these grouped/Counted together regardless the order of the HPs selected.

 

Column is 'HP Selected' and I just want the multiple values as 'Multiple HPs Selected' and group/counted from there. 

 

Hopeisgood1_0-1732546258602.png

 

Thank you!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Hopeisgood1 ,

 

Measures in DAX are context-dependent calculations, meaning their values are determined by the context in which they are used.

 

Because of this, measures do not have fixed values and cannot be directly used for grouping or stacking in visualizations like stacked bar charts.

In this situation, we need to use calculated column to ensure the values are fixed and appropriate for the visualization.

vyajiewanmsft_0-1733190290538.png

HP Selection Status Column = 
VAR HP_Count = 
    IF(
        'Table'[HP Selected]=BLANK(), 
        0,  
        LEN('Table'[HP Selected]) - LEN(SUBSTITUTE('Table'[HP Selected], ",", "")) + 1  
    )
RETURN
    IF(
        HP_Count = 0, 
        "No HP Selected",  
        IF(
            HP_Count = 1, 
            'Table'[HP Selected],  
            IF(
                HP_Count <= 41, 
                "Multiple HPs Selected",  
                "All HPs Selected"  
            )
        )
    )

Result for your reference:

vyajiewanmsft_1-1733190411747.png

Best regards,

Joyce

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

11 REPLIES 11
PhilipTreacy
Super User
Super User

@Hopeisgood1 

 

Create a new column which allows you to give each of the 'multiple values' a name that you can group them on whilst leaving the other values unchanged  e.g.

 

Column = 

SWITCH(

    TRUE(),

    [HP Selected] = "Alpha", "Alpha",

    [HP Selected] = "Beta", "Beta",

    [HP Selected] = "Gamma", "Gamma",

    "Multiple HP's Selected"

)

 

Which gives this

 

PhilipTreacy_0-1732577122363.png

 

You can then create this visual using the new column

 

PhilipTreacy_1-1732577268738.png

 

If that isn't what you want please supply some sample data.

 

Regards

 

Phil

 

 

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hi @PhilipTreacy 

 

I was thinking this:

 

Would the coding be feasible where:

 

If no HP was selected, "No HP selected"

If 1 HP selected, USE that value as whatever the HP is

If 2 to 41 HPs selected, "Multiple HPs Selected"

If 42 or over, "All HPs Selected"

 

This HPs Selected is in a table now...

Hopeisgood1_0-1732669493970.png

 

I am still learning the codings and this isn't my level of expertise yet. I am learning for you all here.

 

Thank you,

Holly

Anonymous
Not applicable

Hi @Hopeisgood1 , hello PhilipTreacy, thank you for your prompt reply!


Please check the following measures:

HP Selection Status = 
VAR HP_Count = 
    IF(
        SELECTEDVALUE('Table'[HP Selected])=BLANK(), 
        0,  
        LEN(SELECTEDVALUE('Table'[HP Selected])) - LEN(SUBSTITUTE(SELECTEDVALUE('Table'[HP Selected]), ",", "")) + 1  
    )
RETURN

    IF(
        HP_Count = 0, 
        "No HP Selected",  
        IF(
            HP_Count = 1, 
            SELECTEDVALUE('Table'[HP Selected]),  
            IF(
                HP_Count <= 41, 
                "Multiple HPs Selected",  
                "All HPs Selected"  
            )
        )
    )

 Result for your reference:

vyajiewanmsft_0-1732777988970.png

Best regards,

Joyce

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

Hi @Anonymous 

 

Thank you for your reply!!!

 

I know the company I work for is using an older version of Power BI Desktop and I am not able to make this work for some reason. The company restricted the upgrade due to HIPAA compliance.  I notice in your current version, you have what is called Measure Tools. I don't 😕 I am not sure if this is causing an issue for my Power BI version? 

 

Hopeisgood1_0-1732891855843.png

 

Hopeisgood1_1-1732892063365.png

 

 

 

Anonymous
Not applicable

Hi @Hopeisgood1 , 

Please note that I created the measures instead of the column, please check it:

vyajiewanmsft_0-1733107016677.png

More information about difference between calculated column and measure for your reference:

Measures vs Calculated Columns in DAX and Power BI | endjin - Azure Data Analytics Consultancy UK

 

Best regards,

Joyce

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

@Anonymous 

 

Ahhh! Ok, I fixed it and I can now see it in a Table in report view. Thank you for that education! My brain is still processing the link you provided. I am still learning this stuff.

 

Thou, I am not able to pull the data into the Y-axis of a stacked bar chart. Automatically went to tooltips box. Not sure why that is? Did I miss something from the link to why this wouldn't work?

 

Hopeisgood1_0-1733155048040.png

 

 

 

 

 

Anonymous
Not applicable

Hi @Hopeisgood1 ,

 

Measures in DAX are context-dependent calculations, meaning their values are determined by the context in which they are used.

 

Because of this, measures do not have fixed values and cannot be directly used for grouping or stacking in visualizations like stacked bar charts.

In this situation, we need to use calculated column to ensure the values are fixed and appropriate for the visualization.

vyajiewanmsft_0-1733190290538.png

HP Selection Status Column = 
VAR HP_Count = 
    IF(
        'Table'[HP Selected]=BLANK(), 
        0,  
        LEN('Table'[HP Selected]) - LEN(SUBSTITUTE('Table'[HP Selected], ",", "")) + 1  
    )
RETURN
    IF(
        HP_Count = 0, 
        "No HP Selected",  
        IF(
            HP_Count = 1, 
            'Table'[HP Selected],  
            IF(
                HP_Count <= 41, 
                "Multiple HPs Selected",  
                "All HPs Selected"  
            )
        )
    )

Result for your reference:

vyajiewanmsft_1-1733190411747.png

Best regards,

Joyce

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

@Anonymous 

 

This is excellent! It works now and this is a great learning tool from you! Also from @PhilipTreacy on the switch in which I used for the Region column as data so simple in that one. 

 

Thank you Thank you Thank YOU!!!!

Holly

HI Phil,

 

Reading upon SWITCH, it sounds like it's a bitty restrictive like not allowing those the same HP with the other HP values in some rows.  

 

But this is what I am looking for. Hope this makes sense?

 

Hopeisgood1_0-1732642838507.png

And for some odd reason, Power BI is not recognizing the HP Selected in the SWITCH.

Hopeisgood1_1-1732643039919.png

Hopeisgood1_2-1732643088825.png

 

 

 

 

This error doesn't make sense...

Hopeisgood1_0-1732638654492.png

 

Definitely checking that today - will keep you posted. Thank you!

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.