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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous1993
Frequent Visitor

Replace N.a with non null Value corresponding to the same supplier-DAX

Hi,

 

I am having a Dax requirement as shown below.

 

SupplierDateRegion
Amul02-08-2022BE
Amul02-08-2022N.A
LGL02-08-2022DE
LGL02-08-2022DE
Air02-08-2022AN
Amul02-08-2022N.A
Hitachi02-08-2022MN
Amul02-08-2022BE
Telecom02-08-2022N.A
Intel02-08-2022LK
Amul02-08-2022N.A
Intel02-08-2022N.A
Intel02-08-2022N.A
Air02-08-2022AN
Amul02-08-2022N.A
LGL02-08-2022N.A
Air02-08-2022N.A

 

I have few N.A values in Region Columns.i Want to replace these Na with the value in supplier column which has aregion value

 

Example, if Supplier 'Amul' is Shown as BE region, all amul with N.a should be replaced with BE.

 

Each supplier will either have only one region or N.a and some regions will have N.a alone which can be left as such.

Hope this is clear.

 

Thanks in advancefor your help.

1 ACCEPTED SOLUTION

@Anonymous1993 
Please use

Region 1 = 
IF ( 
    Suppliers[Region] = "N.A",
    COALESCE(
        MAXX (
            FILTER ( 
                CALCULATETABLE ( 
                    Suppliers, 
                    ALLEXCEPT ( Suppliers, Suppliers[Supplier] )
                ),
                Suppliers[Region] <> "N.A"
            ),
            Suppliers[Region]
        ),
        "N.A"
    ),
    Suppliers[Region]
)

1.png

View solution in original post

5 REPLIES 5
Anonymous1993
Frequent Visitor

works like a charm! thanks @tamerj1  very much

Anonymous1993
Frequent Visitor

@tamerj1 Could you help on this please

Hi @Anonymous1993 
Please use

Region 1 = 
IF ( 
    Suppliers[Region] = "N.A",
    MAXX (
        FILTER ( 
            CALCULATETABLE ( 
                Suppliers, 
                ALLEXCEPT ( Suppliers, Suppliers[Supplier] )
            ),
            Suppliers[Region] <> "N.A"
        ),
        Suppliers[Region]
    ),
    Suppliers[Region]
)

1.png

Can i know why Telecom is returning blank if no other value is there, it should return N.a itself. could you help on that?

@Anonymous1993 
Please use

Region 1 = 
IF ( 
    Suppliers[Region] = "N.A",
    COALESCE(
        MAXX (
            FILTER ( 
                CALCULATETABLE ( 
                    Suppliers, 
                    ALLEXCEPT ( Suppliers, Suppliers[Supplier] )
                ),
                Suppliers[Region] <> "N.A"
            ),
            Suppliers[Region]
        ),
        "N.A"
    ),
    Suppliers[Region]
)

1.png

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors