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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
askpbiuser
Helper I
Helper I

DAX measure to subtract min value from each value

Hi Team,
I am facing an issue with a dax measure being used as a value in a matrix which has field A in rows and B in columns.
I want to get the minimum value from A which can be selected from slicer and subtract it with each value of A.
My output should look like -

ABValueMinResult 
FRCK9.275.763.51
SpCK8.885.763.12
ItCK6.255.760.49
RoCK5.765.760,00


The DAX measure I have written is to calculate Min value which should change based on the country A slicer.

Min =
VAR Sel = VALUES('Dim Table'[A])
VAR _1 =
SUMMARIZE (
FILTER ( ALL('Dim Table') , 'Dim Table'[A] IN Sel ),
'Dim Table'[A],
"Net Val",
[ValueMeasure]
)
VAR _2 =
ADDCOLUMNS (
_1,
"MINVAL",
MINX (
FILTER (
_1,
[Net Val] < EARLIER ( [Net Val] ) && [Net Val] <> 0
),
[Net Val]
)
)
VAR _3 =
MINX ( _2, [MINVAL] )
RETURN
IF (
[ValueMeasure] = 0,
0,
_3
)
This just gives me right minimum total but not minimum value shown against each country in column A. This makes it difficult for me to calculate Result
Any idea on what needs to be done to show same minimum (5.76 as per above example) against each A as the minimum [ValueMeasure] from the slicer selection? if Ro is not selected from slicer then minimum value should be 6.25 to be displayed against each row.
In case something is not clear, please ask. Thank you!

6 REPLIES 6
some_bih
Super User
Super User

Hi @askpbiuser so you want Minimal value per column B in calculated column as solution or as measure?





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

Proud to be a Super User!






I want it as  a measure because Value is a measure and I need Min Required per column B as a measure so that I can use it for next calculation which is Value - Min Required.
So for example for first row it would be 2.46 - 1.98 (Value - Min Required)
For second row for BE , it would be 4.7 - 3.58 and so on. This is as you rightly said per column B.
In a matrix, B is in columns, A is in rows and min required in values
Hope you got the point, else feel free to ask.

askpbiuser_0-1695380816315.png

 

Hi @askpbiuser below is measure, adjust Sheet1 to your table name

 

Min per Column B =
    CALCULATE(
        MINX(Sheet1,Sheet1[Value]),
        ALLEXCEPT(Sheet1,Sheet1[B])
    )

 

Output

some_bih_0-1695385209040.png

Did I answer your question? Kudos appreciated / accept solution!





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

Proud to be a Super User!






Hi @askpbiuser below is measure, adjust Sheet1 to your table name

 

Min per Column B =
    CALCULATE(
        MINX(Sheet1,Sheet1[Value]),
        ALLEXCEPT(Sheet1,Sheet1[B])
    )

 

Output

some_bih_0-1695385209040.png

Did I answer your question? Kudos appreciated / accept solution!





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

Proud to be a Super User!






some_bih
Super User
Super User

Hi @askpbiuser you need to calculate minimal value per column A?

If yes, try measure below. Adjust Sheet1 to your table name. I add some data to show you as example

Min per Column A =
CALCULATE(
    MINX(Sheet1,Sheet1[Value]),
    ALLEXCEPT(Sheet1,Sheet1[A])
)

 

Output

some_bih_0-1695377408107.png

Did I answer your question? Kudos appreciated / accept solution!





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

Proud to be a Super User!






Thank you so much and sorry if I wasn't clear in my question.
I tried your approach and I get the result as Min Now column (next to value) , but what output I need is column Min Required.
Basically for each column B whatever is minimum value in column A becomes the min required.
For example - if filtered on value P in column B then , minimum should be 1.98 assigned to each row.
Let me know if you have any further question.

askpbiuser_0-1695379875211.png

 



Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.