top of page

Using DAX Visual Calculations to compare text values in Power BI

I have recently been tasked with doing some data quality checks in Power BI. I had a couple of options for comparing text values:

1) Build some kind of logic in Power Query

2) Create calculated columns

3) Do it via measures


all options were not viable in my scenario:


1) I needed to pull together info from multiple tables, I did not want to create the joins for performance reasons.

2) The cardinality of the table did not make calculated columns very attractive, I generally try to avoid them also.

3) I played around with a measure but since I am not a DAX expert they were slow. My tables have 10M rows.


That is when I remembered visual calculations and they helped me quickly achieve my comparison.


Instead of comparing text values with IF ( MIN ( Column1 ) = MIN ( Column2) ) which was very very slow, I used a similar function inside a visual calculation.


Now that I am writing this, I probably could have also used a WINDOW function in DAX.


The expression in my visual calculation was very simple:

Check = IF( [Street] = [Street1], 0, 1)

Meaning the 1s have to be checked since they are off.

Table output with "check" column if text values match
Table output with "check" column if text values match

I will build more of these checks later on in this project. Visual Calculations have really helped me to keep everything easy and performant.


Since my tables have about 10 millions rows and my DAX measure was not very performant, this is super fast compared to everything I had tried before.

Comments


bottom of page