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
Anonymous
Not applicable

Reg: Facing issues in comparing two columns

Hi everyone,

 I created the measure to comapre two columns. But the measure is always giving the output 1 only.  kindly help me on this issue.

Vlwk Arrowss =
var plans =SELECTEDVALUE(mis[ach(perc)])
var vlwk =SELECTEDVALUE(mis[lwk])
return
SWITCH (
TRUE,
plans > vlwk,1,
plans = vlwk,0,
plans < vlwk,-1
)

Thanks & regards

poornalingam a

1 ACCEPTED SOLUTION
gdarakji
Resolver III
Resolver III

Try SUM instead of SELECTEDVALUE as SELECTEDVALUE only works when you have a single value. This depends on your data model and the other fields you have in the table but give SUM a try and let us know if it works.

View solution in original post

3 REPLIES 3
v-yetao1-msft
Community Support
Community Support

Hi @Anonymous 

SELECTEDVALUE :When there is only one value in the specified column, the value is returned, otherwise, the candidate result is returned, and the null value is returned when the candidate result is omitted.

For example :

Ailsa-msft_0-1621500416433.png
Ailsa-msft_1-1621500416438.png

If you are sure that your data is single, you can use SELECTEDVALUE . Or you can add a single value to the table, and then make a judgment based on this column .

 

Best Regards

Community Support Team _ Ailsa Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

gdarakji
Resolver III
Resolver III

Try SUM instead of SELECTEDVALUE as SELECTEDVALUE only works when you have a single value. This depends on your data model and the other fields you have in the table but give SUM a try and let us know if it works.

mahoneypat
Employee
Employee

You likely have multiple values in each column in the visual context and both of your SELECTEDVALUE()s are returning BLANK().  Are you confident there are only single values in the visual for each evaluation?  You could try using MIN() instead of SELECTEDVALUE() but will want to make sure there are single values.

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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.