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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
JRadford
New Member

Find rows that are not similar based on values

Hello to anyone who can help, 

 

I have a table like the below. I'm looking into writing a DAX function or something. What I want is if the region and store are the same but the delta is negative, I want a new column to return the row that has the same Region and store with a different city that has a positive delta. 

 

RegionCityStoreDelta
NorthEastNew YorkAntonios-3
WestSan FransiscoFashion-6
West Los AngelesRhode3
NorthEastNew YorkMacys6
MidwestChicagoTorta2
SouthEastAtlantaWalmart-1
SouthEastAtlantaWalmart8
NorthEastNew JerseyAntonios5
West Los AngelesFashion3
NorthEastNew YorkMacys8

 

The new column should state:

 

RegionCityStoreDeltaCity to pull from
NorthEastNew YorkAntonios-3New Jersey
WestSan FransiscoFashion-6Los Angeles
West Los AngelesRhode3 
NorthEastNew YorkMacys6 
MidwestChicagoTorta2 
SouthEastAtlantaWalmart-1Savannah
SouthEastSavannahWalmart8 
NorthEastNew JerseyAntonios5 
West Los AngelesFashion3 
NorthEastNew YorkMacys8 
1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @JRadford - Please find the attached pbix file 

 

use a calcualted column and the logic as below:

City to pull from =
VAR CurrRegion = Inputdata[Region]
VAR CurrStore  = Inputdata[Store]
VAR CurrDelta  = Inputdata[Delta]

VAR PosCity =
    CALCULATE (
        MIN ( Inputdata[City] ),
        FILTER (
            Inputdata,
            Inputdata[Region] = CurrRegion &&
            Inputdata[Store] = CurrStore &&
            Inputdata[Delta] > 0
        )
    )
RETURN
    IF ( CurrDelta < 0, PosCity, BLANK () )

 

rajendraongole1_0-1755786274287.png

 

Hope this helps.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
rajendraongole1
Super User
Super User

Hi @JRadford - Please find the attached pbix file 

 

use a calcualted column and the logic as below:

City to pull from =
VAR CurrRegion = Inputdata[Region]
VAR CurrStore  = Inputdata[Store]
VAR CurrDelta  = Inputdata[Delta]

VAR PosCity =
    CALCULATE (
        MIN ( Inputdata[City] ),
        FILTER (
            Inputdata,
            Inputdata[Region] = CurrRegion &&
            Inputdata[Store] = CurrStore &&
            Inputdata[Delta] > 0
        )
    )
RETURN
    IF ( CurrDelta < 0, PosCity, BLANK () )

 

rajendraongole1_0-1755786274287.png

 

Hope this helps.

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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