Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Is there an update to this?
https://powerpivotpro.com/2011/03/the-magic-of-ifvalues/
=IF(COUNTROWS(VALUES( <Your Column Here> ))=1,
IF(VALUES( <Your Column Here> ) = <Test Value Here> ,
<Result if True> ,
<Result if False> ),
<Result for subtotals and grandtotals> )
That's more straight forward that this nested if? I know there's a hasonevalue formula, but I don't know if it actually changes the structure of this.
Solved! Go to Solution.
Hi @Ffitzpatrick47,
In this scenario, there is no difference.
VALUES returns a one-column table that contains the distinct values from the specified table or column. HASONEVALUE returns TRUE when the context for columnName has been filtered down to one distinct value only. The usage of these two functions are different, but the returned result is the same. They can be used to check the numer of unique records of a column.
Regards,
Yuliana Gu
Hi @Ffitzpatrick47,
Based on my test, nesting HASONEVALUE inside IF function also worked.
Measure = IF(HASONEVALUE(<Your Column Here>)=TRUE(), IF(VALUES(<Your Column Here>)=<Test Value Here>,
<Result if True>, <Result if False>), <Result for subtotals and grandtoals>)
If I have something misunderstood, please provide more description about your question.
Regards,
Yuliana Gu
No, I just wanted to know if there was a difference between using the two.
Hi @Ffitzpatrick47,
In this scenario, there is no difference.
VALUES returns a one-column table that contains the distinct values from the specified table or column. HASONEVALUE returns TRUE when the context for columnName has been filtered down to one distinct value only. The usage of these two functions are different, but the returned result is the same. They can be used to check the numer of unique records of a column.
Regards,
Yuliana Gu
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
146 | |
75 | |
64 | |
52 | |
47 |
User | Count |
---|---|
218 | |
88 | |
73 | |
64 | |
60 |