Forum Discussion

rod_puente's avatar
rod_puente
Helper I
1 year ago
Solved

Min / Max Price

Dear All.

 

Pls your help. I need to calculate the minimum and maximum prices of a painting, here is the following example:

 

 

 

Regards

Rodrigo P.

  • Hi rod_puente ,

    Thank you for reaching out to Microsoft Fabric Community.

    Thank you Ashish_Excel Nasif_Azam ajaybabuinturi for the prompt response.

    I have created pbix file by using sample data, please go through attached pbix for your reference.

     

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

    Thank you.

8 Replies

  • Hey rod_puente ,

    Thanks for sharing the screenshot. From your table, the minimum and maximum prices of the painting are already included in the Min and Max columns. But just to confirm the actual computed values from the "Precio Unitario" (Unit Price) column:

    Calculated Results from Data

    • Minimum Price: 434.00

    • Maximum Price: 685.00

     

    If you're calculating this in Excel, you can use:

    =MIN(D2:D14)
    =MAX(D2:D14)

    Or in DAX:

    Min Price = CALCULATE(MIN('Sales'[Precio Unitario]), ALLEXCEPT(Sales, Sales[Cod Producto]))
    Max Price = CALCULATE(MAX('Sales'[Precio Unitario]), ALLEXCEPT(Sales, Sales[Cod Producto]))

    These formulas calculate:

    • The minimum or maximum price (Precio Unitario)

    • For each distinct Cod Producto

    • While ignoring all other filters in the report except Sales[Cod Producto]

    When to Use These

    • You want to display Min/Max prices by product (e.g., in a matrix or card visual filtered by product)

    • You want consistent Min/Max values across visuals or rows for each product, even if other filters like Fecha or Folio are applied

    • You're not aggregating at the row level, but instead calculating grouped summary values

    When Not to Use It

    • You're already aggregating by Cod Producto in your visual (DAX engine already scopes it correctly)

    • You don’t want to ignore slicers/filters outside of product

     

    If you found this solution helpful, please consider accepting it and giving it a kudos (Like) it’s greatly appreciated and helps others find the solution more easily.


    Best Regards,
    Nasif Azam

     

    • rod_puente's avatar
      rod_puente
      Helper I

      Dear Nasif

       

      Thanks for your solution, but I'd like the formula to allow me to apply time segments, for example, year, month, week, and other filters. When applying the filters, it's ideal for the MIN and MAX values ​​to move within those segment dimensions.

       

      The solution you propose takes the MIN and MAX of the entire database, without considering time segments, such as year and month.

       

      What would the final formula look like?

       

       

      Regards

      Rodrigo Puente

  • Hi rod_puente,

    You can use below measures to achive your requirement. Let me know if you have any questions.

    Min Price = CALCULATE(MIN('Sales'[Precio Unitario]), ALLEXCEPT(Sales,Sales[Cod Producto]))
    Max Price = CALCULATE(MAX('Sales'[Precio Unitario]), ALLEXCEPT(Sales,Sales[Cod Producto]))

    Thanks,
    If you found this solution helpful, please consider giving it a Like👍 and marking it as Accepted Solution✔. This helps improve visibility for others who may be encountering/facing same questions/issues.

  • Ashish_Excel's avatar
    Ashish_Excel
    Solution Supplier

    Hi,

    Try these measures

    Min price = MINX(ALLEXCEPT(Data,Data[Cod Products]),[Precio Unitario])

    Max price = MAXX(ALLEXCEPT(Data,Data[Cod Products]),[Precio Unitario])

    I have assumed that Percio Unitario is a measure that you have written.

    If this does not help, then share the download link of the PBI file.

  • v-venuppu's avatar
    v-venuppu
    Community Support

    Hi rod_puente ,

    Thank you for reaching out to Microsoft Fabric Community.

    Thank you Ashish_Excel Nasif_Azam ajaybabuinturi for the prompt response.

    I have created pbix file by using sample data, please go through attached pbix for your reference.

     

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

    Thank you.

  • v-venuppu's avatar
    v-venuppu
    Community Support

    Hi rod_puente ,

    If you had a chance to review the information provided and solve the issue.If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

  • v-venuppu's avatar
    v-venuppu
    Community Support

    Hi rod_puente ,

    May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

    Thank you.

  • v-venuppu's avatar
    v-venuppu
    Community Support

    Hi rod_puente ,

    I hope this information is helpful.If this answers your question, please accept it as a solution,so other community members with similar problems can find a solution faster.

    Thank you.