Welcome to deBUG.to Community where you can ask questions and receive answers from Microsoft MVPs and other experts in our community.
0 like 0 dislike
5.9k views
in Power BI by 16 16 22

In Power BI, I need to get value based on another column where I have a table with Insurance and I need to get the insurance name that has the minimum price.

Insurance Price
Insurance 1 300
Insurance 2 200
Insurance 3 100

How can I show the lowest value from the first column with the minimum value in the second column?


1 Answer

1 like 0 dislike
by 162 202 397
selected by
 
Best answer

How to get value based on another column in Power BI?

To get the corresponding value based on another column like showing the lowest value from the first column with minimum value in the second column, you have to use the below DAX function

Lowest Price = 
   VAR MinPrice =
         CALCULATE ( Min('Table Name'[Price Field Name] ), ALL ( 'Table Name' ) )
   RETURN
         CALCULATE ( Min('Table Name'[Field Value in First Column]), 'Table Name'[Price Field Name] = MinPrice )

Example

Lowest Degree = 
VAR MinDegree =
    CALCULATE ( Min('Employee Degree'[Degree] ), ALL ( 'Employee Degree' ) )
RETURN
    CALCULATE ( Min('Employee Degree'[Employee]), 'Employee Degree'[Degree] = MinDegree )

Output

get value based on another column in Power BI


How to return value based on another column in Power BI?

Another alternative way to return value based on another column in Power BI is to use the below DAX formula:

Lowest Degree = 
VAR MinDegree =
    CALCULATE (
        MIN('Employee Degree'[Degree])
    )
RETURN
    CALCULATE (
        MIN ( 'Employee Degree'[Employee] ),
        FILTER (
            ALLEXCEPT ( 'Employee Degree' ,'Employee Degree'[Employee]),
            'Employee Degree'[Degree]  = MinDegree
        )
    )

Output

Return value based on another column in Power BI


See Also

by 16 16 22
0 0
Thanks for your clear explanation
If you don’t ask, the answer is always NO!
...