cancel
Showing results for 
Search instead for 
Did you mean: 
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
Power BI Show Episode 10 Recap

The Power BI Community Show

Watch the playback when Amit Chandak, a Power BI Super User, demos how to use Field Parameters to make reports more dynamic.

Health and Life Sciences Power BI User Group

Health and Life Sciences Power BI User Group

Power BI specialists at Microsoft have created a community user group where customers in the provider, payor, pharma, health solutions, and life science industries can collaborate.

Ignite 2022

What's Next at Microsoft Ignite 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Top Solution Authors
Top Kudoed Authors