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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
premm
New Member

How to get a value from one column based on an expression in another column.

I have a table with three columns as mentioned below, I have created a Measure to get the percentage Tot Loged Effort and Expected Effort.

I want to create a measure to get the ”Base Service Unit” name based on maximum percentage in “Percentage Logged/Expected"  (this is a Measure)

desire output should be Cloud as it has maximum percentage.

I would like to create a measure.

 

Base Service Unit

Tot Logged Effort

Expected Effort

Percentage Logged/Expected (Measures)

Cloud

16036.85

17468

92%

Data

5708.33

6336

90%

Digital

17221.17

19170

90%

Digital-2

5579

6372

88%

 

regards,

premm bissht

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

 

Picture1.png

 

Percentage =
AVERAGEX( Data, Data[Tot Logged Effort]/Data[Expected Effort])
 

 

MAX percentage Base Service Unit =
VAR maxpercentage =
SUMX (
KEEPFILTERS ( TOPN ( 1, ALL ( Data[Base Service Unit] ), [Percentage], DESC ) ),
[Percentage]
)
RETURN
CALCULATE (
SELECTEDVALUE ( Data[Base Service Unit] ),
FILTER ( ALL ( Data[Base Service Unit] ), [Percentage] = maxpercentage )
)

 

https://www.dropbox.com/s/slxsr4ezftnx3ru/premm.pbix?dl=0 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

3 REPLIES 3
premm
New Member

thanks JiHwan Kim,

 

its working fine for me.

 

 

Remi_Bouvier
Frequent Visitor

Hi,

Can you try the below measure please?

Base Service Unit max = 
VAR PercBSU = 
ADDCOLUMNS(
    ALLSELECTED('Table'[Base Service Unit]),
    "@Percentage",[Percentage Logged/Expected]
)
Var MaxPerc =
MAXX(
    ALLSELECTED('Table'[Base Service Unit]),
    [Percentage Logged/Expected]
)
VAR Result = 
CALCULATE(
    MAX('Table'[Base Service Unit]),
    FILTER(PercBSU, [@Percentage] = MaxPerc)
)
RETURN 
    Result

 

I am able to return the correct output.

Remi_Bouvier_0-1624689352125.png

You can change the ALLSELECTED to VALUES in PercBSU variable to get "Cloud" only showing up on the cloud row.

 

 

Jihwan_Kim
Super User
Super User

 

Picture1.png

 

Percentage =
AVERAGEX( Data, Data[Tot Logged Effort]/Data[Expected Effort])
 

 

MAX percentage Base Service Unit =
VAR maxpercentage =
SUMX (
KEEPFILTERS ( TOPN ( 1, ALL ( Data[Base Service Unit] ), [Percentage], DESC ) ),
[Percentage]
)
RETURN
CALCULATE (
SELECTEDVALUE ( Data[Base Service Unit] ),
FILTER ( ALL ( Data[Base Service Unit] ), [Percentage] = maxpercentage )
)

 

https://www.dropbox.com/s/slxsr4ezftnx3ru/premm.pbix?dl=0 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors