Forum Discussion
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.
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"
I basically need this replicated but in Power BI as a measure/column
Hi SK456
I have a new idea for this thread. Please download my pbix file to see if it can meet your need.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
4 Replies
- MahyarTFMemorable 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"))) - SK456Frequent 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?
- v-jingzhangCommunity Support
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 - v-jingzhangCommunity Support
Hi SK456
I have a new idea for this thread. Please download my pbix file to see if it can meet your need.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.