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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
GuillaumeL06
Regular Visitor

New value in a column with a DAX code

Hello everyone,

I have a table :

Site                                      Frs                                       Code                   

NAB                                    A                                          X                          

NAB                                    A                                          X

P7                                      A                                          Y

P3                                      A                                          Z

P3                                      A                                          Z

Result table expected :

Site                                      Frs                                       Code                   

NAB                                    A                                          Y                          

NAB                                    A                                          Y

P7                                      A                                          Y

P3                                      A                                          Y

P3                                      A                                          Y

In other words, I would like to have in the column « code », the resulting code of « frs » = « A » when we have the « site » = « P7 ». I would like to have a DAX code for that request please.

Thanks a lot

1 ACCEPTED SOLUTION
Anonymous
Not applicable

you can try:

CODE = 
IF(
    SEARCH("P7",
        CONCATENATEX(
            FILTER(
                'Table',
                'Table'[Frs] = EARLIER('Table'[Frs])
            ),
            'Table'[Site],",")
        ,,0),
    "Y",
"N")

Search Concatenatex Earielr.png

I added P3/B to test

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

you can try:

CODE = 
IF(
    SEARCH("P7",
        CONCATENATEX(
            FILTER(
                'Table',
                'Table'[Frs] = EARLIER('Table'[Frs])
            ),
            'Table'[Site],",")
        ,,0),
    "Y",
"N")

Search Concatenatex Earielr.png

I added P3/B to test

Or if you just want the value of Code for Site="P7" and Frs="A" for every row you could do the following:

 

2019-07 code lookup.png

 

Code2 = LOOKUPVALUE('Table'[Code],'Table'[Site],"P7",'Table'[Frs],"A")

Although I'm not sure why you'd want this in a column it feels more like something that you'd using a measure.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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