Forum Discussion

singh_gagan03's avatar
singh_gagan03
Frequent Visitor
5 years ago

DAX Requirement || Help

Hi All,

 

I am facing a problem in writing DAX for the scenario explained below, need help asap. The Data Source is Excel Worksheet.

 

Visuals on page: 2 slicers (country and item) and matrix visuals 

 

In the image, the yellow column is the desired result.

 

Scenario 1 Please check the image below and in the particular matrix visual I have Item, Country, Value, Volume, and Price. I need to find the minimum price for an item across the countries and the name of the country giving that minimum price.

 

Scenario 2 Please check the image below and now I am changing the country selections in the slicers and item slicer kept as it is now the minimum price for an item should change according to the country selections and the name of the country minimum price should also be updated.

 

Scenario 3 Please check the image below and now I am changing the item and the country selections are kept as it is now the minimum price for an item should change according to the country selections and the name of the country minimum price should also be updated.

 

Please help me writing a DAX for the below scenarios, it would be great if we can connect for the explanation of the DAX as well and TIA in advance. 

 

 
 

 

 

 

2 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    singh_gagan03 

    Min Price=CALCULATE(MIN(Table[Price]),ALLEXCEPT(Table,Table[Item]),ALLSELECTED(Table[Country]))

    Country With Min Price=CONCATENATEX(TOPN(1,CALCULATETABLE(Table,ALLEXCEPT(Table,Table[Item]),ALLSELECTED(Table[Country])),CALCULATE(MIN(Table[Price])),ASC),Table[Country],",")

    • singh_gagan03's avatar
      singh_gagan03
      Frequent Visitor

      HI wdx223_Daniel ,

       

      I have implemented the min price DAX but the result I am getting is not aligned as per the image I shared with you. The DAX you have shared with me is giving me the minimum value as same across slicer selections.

       

      For example in scenario 1 the DAX for Item 1 it is returning me min price as 33.33 and country as C1 for all selections which are correct but when I make the selection as Country = C2, C3 then the min price should be 100, and the country now be C2.