Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi, it's the first time that I post. I am quite new at Power Bi.
I have been trying to understant how to use the CONTAINS function. I do the same thing as the video does but I keep getting the same result for every line. I m trying to get true if the column A =1 and if the column B = 2, if not --> false
So I wrote:
Solved! Go to Solution.
Hi @Anonymous ,
If you use calculate column, the Contains() function is for all data in each column.
For example:
As long as there is one row in the data of the two columns [PRIX A] and [PRIX B] that satisfies the conditions of [PRIX A]=1&&[PRIX B]=2, the whole calculated column will all display True, if not satisfied, all will display False.
If Measure is used and it is a table visual table, each row is equivalent to a data table, so at this time there is only this row of data in the data table.
For example:
[PRIX A]=1,[PRIX B]=2, it is equivalent to an independent table, this table also has only this row of data, and it is True if it meets the conditions
[PRIX A]=2,[PRIX B]=2, this row is also equivalent to an independent table, but if it does not meet the conditions, it is False.
https://towardsdatascience.com/power-bi-calculated-measures-vs-calculated-columns-9be012e9bff1
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
If you use calculate column, the Contains() function is for all data in each column.
For example:
As long as there is one row in the data of the two columns [PRIX A] and [PRIX B] that satisfies the conditions of [PRIX A]=1&&[PRIX B]=2, the whole calculated column will all display True, if not satisfied, all will display False.
If Measure is used and it is a table visual table, each row is equivalent to a data table, so at this time there is only this row of data in the data table.
For example:
[PRIX A]=1,[PRIX B]=2, it is equivalent to an independent table, this table also has only this row of data, and it is True if it meets the conditions
[PRIX A]=2,[PRIX B]=2, this row is also equivalent to an independent table, but if it does not meet the conditions, it is False.
https://towardsdatascience.com/power-bi-calculated-measures-vs-calculated-columns-9be012e9bff1
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you,
But then does that mean that we can't use CONTAINS in a calculated column?
@Anonymous, Follow above measure suggestion using CONTAINS else try with IF ELSE using calculated column:
@Anonymous Create a measure to get the result. Refer the below screen shot:
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 47 | |
| 44 | |
| 39 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 70 | |
| 68 | |
| 32 | |
| 27 | |
| 25 |