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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SK456
Frequent Visitor

Comparing values in a column and outputting a string

Hi,

So I have a matrix and need to compare two columns and return a string.

 

SK456_0-1668120166889.png

The 1's are basically a distinct count of a part number on a certain extraction date. So I want to compare between two selected extraction date if Column1 = Column 2 return "No Change", if Column 1 is blank and Column 2 is "1" return "New", if Column 1 is "1" and Column 2 is blank return "Removed"

 

SK456_1-1668120827340.png

I basically need this replicated but in Power BI as a measure/column

1 ACCEPTED SOLUTION

Hi @SK456 

 

I have a new idea for this thread. Please download my pbix file to see if it can meet your need. 

vjingzhang_0-1669370695911.png

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

 

View solution in original post

4 REPLIES 4
SK456
Frequent Visitor

Hi MahyarTF,

For you the columns are named Col1 and Col2 however in my matrix the columns are the extraction dates which changes depending on the dates selected through the slicer, as you can see in the image. How would I go about this?

Hi @SK456 

 

I have a new idea for this thread. Please download my pbix file to see if it can meet your need. 

vjingzhang_0-1669370695911.png

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

 

Hi @SK456 

 

Do you add Date column to Column of a matrix visual? If so, it's difficult to add an additional column next to the second date column in the same matrix. Once add a field to Values well, it will display in every date column. It cannot show the value as you show in Excel. 

 

Best Regards,
Community Support Team _ Jing

MahyarTF
Memorable Member
Memorable Member

Hi,

Use the below code to create the new Column :

Status = if (Sheet20[Col1] = Sheet20[Col2], "No Change",
            if ( ISBLANK(Sheet20[Col1]) && Sheet20[Col2] = 1, "New",
                if( Sheet20[Col1] = 1 && ISBLANK(Sheet20[Col2]), "Removed")
               )
        )
MahyarTF_0-1668128233937.png

 

Mahyartf

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.