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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
JRadford
Frequent Visitor

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors