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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Loic_Pedro_Hans
Regular Visitor

Formula for identify if a code client is in a table

I create a new table with unique value (By SUMMMARIZE)
I try to add a column that the value is 1 if [CLG_CODE] is in PTE[CLG_CODE], and 0 if is not present
but there is an error (in red in the formula)
Thank for your help.
 
My_SMS =
ADDCOLUMNS(
    SUMMARIZE(
        SMS,
        SMS[AGC_LIBC],
        SMS[CLG_CODE],
        SMS[CAT_LIBC],
        SMS[Type]
    ),
    "Code Client", SMS[CLG_CODE],
    "PTE", IF (
                CALCULATE(
                    COUNTROWS(PTE),
                    PTE[CLG_CODE] = [Code Client]
                ) > 0, 1, 0
            )
)
1 REPLY 1
lbendlin
Super User
Super User

You cannot reference a field in the same step where you define it.  Wrap your ADDCOLUMNS in another ADDCOLUMNS.

 

Why not use [CLG_CODE]  directly?

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors