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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
dkeerthi
Frequent Visitor

first apply slicer value, then group by and then concatenate/roll-up cells

I have the below table as raw data:

dkeerthi_4-1647638338678.png

How do i generate the below output table for slicer value - 2021 and 2022. I want to first apply the slicer value on year column, then group the procedures by person, then get a count. For ex: john has 2 procedures A & B - so want to concantenate A+B and count is as 1. 

dkeerthi_5-1647638473534.png

 

4 REPLIES 4
v-yalanwu-msft
Community Support
Community Support

Hi, @dkeerthi ;

Is your problem solved? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

Hi, @dkeerthi ;

You could create a measure as follows:

Procedure2 = CONCATENATEX('Data',[Procedure],"+")

as count : Through your description, I don't quite understand what your counting logic is, please correct me if I understand wrong.

count = 
var _count=CALCULATE(COUNT(Data[Procedure]),FILTER(ALLSELECTED(Data),[Person]=MAX([Person])))
return IF(_count>1,1,2)

The final output is shown below:

vyalanwumsft_0-1647914600238.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

dkeerthi
Frequent Visitor

just wondering on how do i pass slicer values for years?

m3tr01d
Continued Contributor
Continued Contributor

hi @dkeerthi 
I don't think there's an easy way to do this. 
I got something but it's not really flexible.

You can make a Calculated Table with this code

Procedures = 
CALCULATETABLE(
    SUMMARIZECOLUMNS(
        Data[Person],
        "Procedure",
            CONCATENATEX(
                VALUES( Data[Procedure] ),
                Data[Procedure],
                "+",
                Data[Procedure],
                ASC
            )
    ),
    Data[Year] IN {2021,2022}
)

 

Then, you can make a measure to count the number of rows of this table :

Person_Count = COUNTROWS( Procedures )

 

Then, you should be able to drag the field Data[Procedure] on the table with [Person_Count] on values.

Maybe, someone has a better solution 🙂

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.