Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
YogeshWaran2010
Frequent Visitor

Help in comparing values in a same column.

Hi,

 

I am trying to achieve a result by comparing two rows in a column and show output based on a condition. I have shared a simple layout of the table on the below image ,

 

We are trying to achieve result similar to 

 

As you can we need add a column with comparison both row data for different and If equal show "O" and not equal "X".

 

Thank you

1 ACCEPTED SOLUTION
v-jianpeng-msft
Community Support
Community Support

Hi, @YogeshWaran2010

here is my solution:

To achieve this effect, the table is mainly converted through the pivot column, and the corresponding effect is derived by comparing it using a DAX expression.

First step, we need to import data to power BI desktop , and click transform data :

1.png

And then, we click transform >> Pivot column:

Note: We need to select the date column and then click on the pivot column

2.png

And then, values column we select amount >> click OK. And then, we click close and apply:

3.png

4.png

And then, we click table view >> new column:

5.png

6.png

Now, We enter the DAX expression:

IF('Table 1 (Tabelle1)'[4/1/2023] = 'Table 1 (Tabelle1)'[12/1/2023], "O","X")

 

7.png

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without priv...

Best Regards

Jianpeng Li

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

View solution in original post

2 REPLIES 2
v-jianpeng-msft
Community Support
Community Support

Hi, @YogeshWaran2010

here is my solution:

To achieve this effect, the table is mainly converted through the pivot column, and the corresponding effect is derived by comparing it using a DAX expression.

First step, we need to import data to power BI desktop , and click transform data :

1.png

And then, we click transform >> Pivot column:

Note: We need to select the date column and then click on the pivot column

2.png

And then, values column we select amount >> click OK. And then, we click close and apply:

3.png

4.png

And then, we click table view >> new column:

5.png

6.png

Now, We enter the DAX expression:

IF('Table 1 (Tabelle1)'[4/1/2023] = 'Table 1 (Tabelle1)'[12/1/2023], "O","X")

 

7.png

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without priv...

Best Regards

Jianpeng Li

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

Hi @v-jianpeng-msft ,

 

Thank you for your support. I can achieve my results using these steps.

I have some doubts, if we have multiple dates then this method would not be feasible right?

If we wish implement it in the actual data where we will be required to compare multiple dates is there any work around.

 

Thank you

Yogesh

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors