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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.