cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

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.

 

 

2-11-2017 12-01-14 AM.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Microsoft
Microsoft

Re: Distinct values and count values from multiple columns

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. 
1.PNG

 

Thanks,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

3 REPLIES 3
Highlighted
Microsoft
Microsoft

Re: Distinct values and count values from multiple columns

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. 
1.PNG

 

Thanks,
Yuliana Gu

Community Support Team _ Yuliana Gu
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

Highlighted
Regular Visitor

Re: Distinct values and count values from multiple columns

Thanks Yuliana, works perfectly, appreciate your assistance!

Highlighted
Frequent Visitor

Re: Distinct values and count values from multiple columns

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?

Helpful resources

Announcements
Community Blog

Community Blog

Visit our Community Blog for articles, guides, and information created by fellow community members.

Using the Community

Using the Community

Need help with the Power BI Community? Our 'Using the Community' support articles are a great place to start.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors