cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Compare price

Hello I have a very simple table.
I need to pick a Country and then show price of all other countries. So, if I pick Australia, I need to see All other countrise and price, but do not show Austratia.

2018-11-23_10-09-06.jpg
Thanks

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Compare price

Should be able to use the same basic concept to create a flag variable. First, don't connect your slicer to your table. Then create a flag measure like:

 

Measure Flag = 
VAR __selected = MAX('Table'[Column]) //value from slicer
RETURN
IF(MAX([Country]) = __selected,0,1)

Filter on this measure.


I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

v-yulgu-msft Super Contributor
Super Contributor

Re: Compare price

Hi @Anonymous,

 

Create a calculated table which lists all slicer selections. This table should be unrelated to source data table.

slicerTable = VALUES('TB1'[Country])

Add below measure to visual level filters, set its value to 0.

check = IF(SELECTEDVALUE(slicerTable[Country])=SELECTEDVALUE(TB1[Country]),1,0)

To calculate the price of selected country as a comparison, please create below measure.

value for selected country = CALCULATE(SUM(TB1[Price]),FILTER(TB1,TB1[Country]=SELECTEDVALUE(slicerTable[Country])))

1.PNG

Best regards,

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.
6 REPLIES 6
Super User
Super User

Re: Compare price

I wrote something like this once:

 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Inverse-Aggregator/m-p/342266

 


I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Anonymous
Not applicable

Re: Compare price

I'm not looking to aggregate data, simple want to show country and price in grid mode of all other countries then the selected country. Something like this

2018-11-23_10-09-06.jpg

Super User
Super User

Re: Compare price

Should be able to use the same basic concept to create a flag variable. First, don't connect your slicer to your table. Then create a flag measure like:

 

Measure Flag = 
VAR __selected = MAX('Table'[Column]) //value from slicer
RETURN
IF(MAX([Country]) = __selected,0,1)

Filter on this measure.


I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Anonymous
Not applicable

Re: Compare price

But country is coming form the same table.

Highlighted
Super User
Super User

Re: Compare price

Create a new table:

 

New Table = VALUES('Table'[Country])

I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

v-yulgu-msft Super Contributor
Super Contributor

Re: Compare price

Hi @Anonymous,

 

Create a calculated table which lists all slicer selections. This table should be unrelated to source data table.

slicerTable = VALUES('TB1'[Country])

Add below measure to visual level filters, set its value to 0.

check = IF(SELECTEDVALUE(slicerTable[Country])=SELECTEDVALUE(TB1[Country]),1,0)

To calculate the price of selected country as a comparison, please create below measure.

value for selected country = CALCULATE(SUM(TB1[Price]),FILTER(TB1,TB1[Country]=SELECTEDVALUE(slicerTable[Country])))

1.PNG

Best regards,

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.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 199 members 2,157 guests
Please welcome our newest community members: