Forum Discussion

Adity's avatar
Adity
Regular Visitor
4 years ago
Solved

MIN Function giving wrong total

I have 2 measures say
Total_Sales & Sales_LastYear.
I needs to find the MIN of these two column and sum the MIN value. When I do so, It shows the sum of Sales_LastYear.
Dax used:
Minimum (Incorrect Total) = MIN( [Total Sales], [Sales LY] )
Where am I going wrong?
  • Hi, Adity 

    Maybe it need a little modified ,try to add another formula as below:

    Measure = SUMX('Table',[Minimum (Incorrect Total)])

    or

    Measure = SUMX('Date'[Month Year],[Minimum (Incorrect Total)])

     

    If it doesn't work , please share your sample file for further research.

     

    Best Regards,
    Community Support Team _ Eason

8 Replies

  • Adity , For total you need force a row context

     

    example

     

    Sumx(Values('Date'[Month Year]), calculate( MIN( [Total Sales], [Sales LY] )))

    • Adity's avatar
      Adity
      Regular Visitor

      amitchandak  For some reason I dont find any change in the solution. By giving your query i wasnt able to see the MIN values in my column.

  • Hi Adity ,
    can you please share some sample data for the same and also the expected output ?

    • Adity's avatar
      Adity
      Regular Visitor

      This i what I am expecting.. It has the total sales thi year and total sales last year. It finds the MIN .. BUt while summing up .. It creates an issue. Need help to fix thisThis is the sample.. Have the Total sales and comparing with sales last year. Finding the Minimum of it too! but somewhere I miss the total of it.. Can u suggest something on why this happens?

  • Hi Adity 

    You need to show us your data and what you are doing otherwise we're working in the dark and guessing.

    You said that you've got 2 measures and that you need to find the MIN of these 2 columns.  Measures and Columns are different things.  You can't get the MIN of a measure because a measure only produces a single value.

    Again, without seeing you data and your calculations, it's not clear what you are trying to do.

    Regards

    Phil

    • Adity's avatar
      Adity
      Regular Visitor

      PhilipTreacy .. Can you please check the tread below.. I added the picture of What i am expecting excatly. 

    • Adity's avatar
      Adity
      Regular Visitor

      If you can see the total.. It shows 1,68,075.. But it should have been close to 6000.. 😞

      • v-easonf-msft's avatar
        v-easonf-msft
        Community Support

        Hi, Adity 

        Maybe it need a little modified ,try to add another formula as below:

        Measure = SUMX('Table',[Minimum (Incorrect Total)])

        or

        Measure = SUMX('Date'[Month Year],[Minimum (Incorrect Total)])

         

        If it doesn't work , please share your sample file for further research.

         

        Best Regards,
        Community Support Team _ Eason