Forum Discussion

Krisztian's avatar
Krisztian
Regular Visitor
9 years ago
Solved

Distinct values and count values from multiple columns

 

Hello,

I have a scenario where need to list the distinct regions through multiple columns (Impacted Site.A, Impacted Site. B, etc) and also count how many times they show up in those columns. Can you please advise how it can be done with Power BI?

Thanks.

 

 

  • Hi Krisztian,

     

    In this scenario, please try this DAX formula to create a calculated table. Add a new column, specify a non-blank value for it.

    Table =
    UNION (
        SELECTCOLUMNS ( Site, "SiteList", Site[Impacted Site.A] ),
        SELECTCOLUMNS ( Site, "SiteList", Site[Impacted Site.B] ),
        SELECTCOLUMNS ( Site, "SiteList", Site[Impacted Site.C] ),
        SELECTCOLUMNS ( Site, "SiteList", Site[Impacted Site.D] ),
        SELECTCOLUMNS ( Site, "SiteList", Site[Impacted Site.E] )
    )

    Column = 1


    Then, drag a table visual in your report. 

     

    Thanks,
    Yuliana Gu

3 Replies

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi Krisztian,

     

    In this scenario, please try this DAX formula to create a calculated table. Add a new column, specify a non-blank value for it.

    Table =
    UNION (
        SELECTCOLUMNS ( Site, "SiteList", Site[Impacted Site.A] ),
        SELECTCOLUMNS ( Site, "SiteList", Site[Impacted Site.B] ),
        SELECTCOLUMNS ( Site, "SiteList", Site[Impacted Site.C] ),
        SELECTCOLUMNS ( Site, "SiteList", Site[Impacted Site.D] ),
        SELECTCOLUMNS ( Site, "SiteList", Site[Impacted Site.E] )
    )

    Column = 1


    Then, drag a table visual in your report. 

     

    Thanks,
    Yuliana Gu

    • Krisztian's avatar
      Krisztian
      Regular Visitor

      Thanks Yuliana, works perfectly, appreciate your assistance!

    • jlynch's avatar
      jlynch
      Frequent Visitor

      this works except, it's not being filtered by my report level filters, it seems since all the values come from a table that is being filtered it should work, any pointers on the filtering?