Forum Discussion

sanjaymithran's avatar
sanjaymithran
Helper II
4 months ago
Solved

Count Policy By Country

Hi All,

Need help for slicers, in country slicer should display Country (Count Policy) as mentionede below

CountryPolicy Slicer
US342 Country
US223 US (8)
US6745 Malaysia (5)
US343 Singapore (4)
US765  
US322  
US113  
US431  
Malaysia543  
Malaysia544  
Malaysia545  
Malaysia546  
Malaysia547  
Singapore623  
Singapore625  
Singapore627  
Singapore629  
  • Hi sanjaymithran,

     

    You can achieve it by adding a new column in the table with DAX

     

    Country Display =
    PolicyData[Country] &
    " (" &
    CALCULATE(
        COUNT(PolicyData[Policy]),
        ALLEXCEPT(PolicyData, PolicyData[Country])
    )
    & ")"
     
    Attached is the example .pbix for you.
     
    ๐ŸŒŸ I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
    ๐Ÿ’ก Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
    ๐ŸŽ– As a proud SuperUser and Microsoft Partner, weโ€™re here to empower your data journey and the Power BI Community at large.
    ๐Ÿ”— Curious to explore more? [Discover here].
    Letโ€™s keep building smarter solutions together!

2 Replies

  • Hi sanjaymithran,

     

    You can achieve it by adding a new column in the table with DAX

     

    Country Display =
    PolicyData[Country] &
    " (" &
    CALCULATE(
        COUNT(PolicyData[Policy]),
        ALLEXCEPT(PolicyData, PolicyData[Country])
    )
    & ")"
     
    Attached is the example .pbix for you.
     
    ๐ŸŒŸ I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
    ๐Ÿ’ก Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
    ๐ŸŽ– As a proud SuperUser and Microsoft Partner, weโ€™re here to empower your data journey and the Power BI Community at large.
    ๐Ÿ”— Curious to explore more? [Discover here].
    Letโ€™s keep building smarter solutions together!
  • Hi sanjaymithran ,

    if I understand your setup right and your table has the two columns Country and Policy, the following steps should work:

    1. Define a measure: CountPolicies=DISTINCTCOUNT(Tablename[Policy])
    2. Add a table visual to your project
    3. Add Country as column to the table
    4. Add the measure as column to the table

    Hope that helps you.