Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Adding Counts to Slicer

Hi everyone,

 

I am new to PowerBI. I am trying create a slicer of Account Names in Each Region. For better clarity I wanted to include count of account names in each region over the slicer and total accounts in select all option, I have added a mock visual of what I am trying to emulate.

 

 

I had a look at few suggested solutions but for some reason those DAX turn out into numerical measures and I am unable to add them to slicer.

Looking forward to your suggestions, Thank you so much in advance for your time.

Thanks

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous 

     

    The following method is for your reference.

     

    Sample:

     

    Data table:

     

    1. Create a new table as the Slicer:

     

    2. Relationship between two tables

     

    3. Create a calculated column in the Slicer table

     

    slicer = 
    VAR _count = CALCULATE(COUNT('Data'[Region]), ALLEXCEPT('Slicer', 'Slicer'[Region]))
    VAR _countAll = COUNTROWS(Data)
    RETURN
    IF([Region] <> "All Regions", [Region] & "(" & _count & ")", [Region] & "(" & _countAll & ")")

     

     

     

    Output:

     

     

    If you still have questions, please provide some sample data so that I can better help you. How to provide sample data in the Power BI Forum - Microsoft Fabric Community Or show it as a screenshot or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

     

    Best Regards,
    Yulia Xu

     

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

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    Thanks a lot for this, it worked 

    I really appreciate the detailed explanation made it a lot easier for me,

    Thanks

    Khush

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

     

    The following method is for your reference.

     

    Sample:

     

    Data table:

     

    1. Create a new table as the Slicer:

     

    2. Relationship between two tables

     

    3. Create a calculated column in the Slicer table

     

    slicer = 
    VAR _count = CALCULATE(COUNT('Data'[Region]), ALLEXCEPT('Slicer', 'Slicer'[Region]))
    VAR _countAll = COUNTROWS(Data)
    RETURN
    IF([Region] <> "All Regions", [Region] & "(" & _count & ")", [Region] & "(" & _countAll & ")")

     

     

     

    Output:

     

     

    If you still have questions, please provide some sample data so that I can better help you. How to provide sample data in the Power BI Forum - Microsoft Fabric Community Or show it as a screenshot or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

     

    Best Regards,
    Yulia Xu

     

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