Hasonevalue/ selected value

I have a question from the above video. At 2:20, the example being discussed suggests is VALUES(customers[customer Names]), this gives the error, and the error is being caused by the total. So the solution for this used to be IF(HASONEVALUE(Customers[Customer Names] ), VALUES(customers[customer Names]), BLANK() )

My questions are :

  1. The first question that came to me is what if I turn off the total formatting section and then try VALUES(customers[customer Names]), - well I tried that and it still didn’t work.:slight_smile: - So how is it that it didn’t work when there was no total required in the table.

  2. The Second question is how wrapping up the above formula in “IF(HASONEVALUE)” or “SELECTEDVALUE” resolves the previous error that was caused by total.

I think in both cases I havent understood the background of the relationship with total, Can you put me in the right direction

@jps

  1. I tried to replicate the scenario, and it works fine for me, did you turn off the totals before showing the measure in the table?
  2. HASONEVALUE checks if only one value is visible for Customer Name in the current filter context, once the condition is satisfied, IF moves on and uses either the TRUE branch or the FALSE branch, to simply which in the video TRUE is for VALUES () and False is for BLANK
    IF + HASONEVALUE + VALUES construct is how problems were solved before release of SELECTEDVALUE

Release information:
HASONEVALUE:

SELECTEDVALUE:

1 Like
  1. Okay, I turned off the total as the measure was still there and showing an error. - It’s resolved now.

  2. yes I get that. The same logic is applying to the total and since it’s not a single value, it’s showing blank , which was earlier leading to error.

Thank you :+1:

1 Like