cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SantoshKumar
Microsoft
Microsoft

Two Columns Data to bring into One Slicer

Hi All,

 

Due to Data sensitivity, i am representing the values as below.


Requirement: 
I have two columns as below

Column1Column2
AppleBlue
OrangeBlack
AppleGreen
AppleGreen
AppleGreen
OrangeGreen
AppleGreen
OthersBlack
OrangeBlue
OthersBlue
AppleBlack
OrangeBlue
OthersGreen
OthersBlue
OrangeBlack
OthersGreen
OrangeGreen
OthersBlack
AppleBlue
AppleBlack

 

Here i am concerned with only three data point: two values from Column1 and one from Column2.

Apple8
Orange6
Green8

 

I have to bring up a Slicer which should show values of only "Apple,Orange and Green" and it need to project the same count as mentioned above.
But when i try to apply condtions involing two columns then i am getting unique values as per selection. for example, Apple and Orange are showing as expected but when i select Green then it shows as 2 (as other 6 values are part of Apple & Orange).



Regards

Santosh Kumar 

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @SantoshKumar ,

 

Create a slicer table like below:

vjaywmsft_0-1670209311120.png

Then create a measure:

Measure = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Column1]=SELECTEDVALUE(Slicer[value])||'Table'[Column2]=SELECTEDVALUE(Slicer[value])))

vjaywmsft_1-1670209353763.png

 

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @SantoshKumar ,

 

Create a slicer table like below:

vjaywmsft_0-1670209311120.png

Then create a measure:

Measure = CALCULATE(COUNTROWS('Table'),FILTER('Table','Table'[Column1]=SELECTEDVALUE(Slicer[value])||'Table'[Column2]=SELECTEDVALUE(Slicer[value])))

vjaywmsft_1-1670209353763.png

 

 

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@SantoshKumar , if you want that king of display, then you need to unpivot the table

https://radacad.com/pivot-and-unpivot-with-power-bi

 

Or create a table

distinct(union(distinct(Table[Column1]) ,Table[Column2]) ))

 

join with both the columns, one join will active and one will inactive ,

then use userelationship and use that measure to create

 

dim = count(Table1[Colum1]) _ calculate(count(Table1[column1], userelationship(dim[column1], table[column2]))

 

assume join with column two in inactive

Helpful resources

Announcements
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.