Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Card showing the minimum value for a given slicer

Hi,

 

I have two datasets:

 

1. Shows the products and their prices, for instance:

 

Product code  Price

111                  20

111                  22

111                  23

222                  120

...

 

2. Shows countries and average price of the product in this country

 

Product code   Country  Average price

111                   Poland    20

111                   Italy        25

111                   China      16

 

I would like to visualise:

 

a) the country with the minimum price for a chosed product (for instance, a card saying "You should buy this product in China", if the code chosen in the slicer is 111)

b) the total savings if the "best" country is chosen ("You paid xxx, if you bought this in China, you would have paid yyy")

 

This seems like it should be pretty straightforward however I am stuck at the moment and would appreciate any tips.

 

Thank you in advance.

2 ACCEPTED SOLUTIONS

Hi @Anonymous 

 

try this Measures

 

Where to buy = "You should buy this product in " & SELECTCOLUMNS(TOPN(1;'Product by Country';'Product by Country'[Average price];ASC);"Country";'Product by Country'[Country])
 
Saving =
var top1 = TOPN(1;'Product by Country';'Product by Country'[Average price];ASC)
return "You paid "& AVERAGE('Product'[Price]) &", if you bought this in "&SELECTCOLUMNS(top1;"Country";'Product by Country'[Country])&", you would have paid " & SELECTCOLUMNS(top1;"Saving";'Product by Country'[Average price])
 
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
 
Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


View solution in original post

Hi @Anonymous ,

 

did you solve your problem?

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


View solution in original post

3 REPLIES 3

Hi @Anonymous 

 

try this Measures

 

Where to buy = "You should buy this product in " & SELECTCOLUMNS(TOPN(1;'Product by Country';'Product by Country'[Average price];ASC);"Country";'Product by Country'[Country])
 
Saving =
var top1 = TOPN(1;'Product by Country';'Product by Country'[Average price];ASC)
return "You paid "& AVERAGE('Product'[Price]) &", if you bought this in "&SELECTCOLUMNS(top1;"Country";'Product by Country'[Country])&", you would have paid " & SELECTCOLUMNS(top1;"Saving";'Product by Country'[Average price])
 
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.
 
Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Hi @Anonymous ,

 

did you solve your problem?

 

If I answered your question, please mark my post as solution, this will also help others.

Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


Anonymous
Not applicable

Works great, thank you!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.