cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
ChoiJunghoon
Helper III
Helper III

How to create the new columns in the variable table....

Hello.

I have a issue again.

 

Table1 

ModuleID| StatusScore| Sequence| Loction
A101A
A102B
A113C
A205D
A203E
A204F
A311A
A3102B
A313C
A404D
A4205E
A406F
A507A
A508B
A509C

 

Table2 (remove)

ModuleID
A1

 

................................................................................................................

I would like to create the table by using DAX as like below it 

ModuleID| SUMStatusScore| LastSequence| Location
A3125D
A4206F

 

Create Table=
VAR x0=SUMMARIZE(filter(Table1, not(Table1[ModuleID] in values(Table2[ModuleID])) ,Table1[ModuleID],"SUM_",SUM(Table1[StatusScore]),"LastSequence",MAX(Table1[Sequence])

VAR x1=ADDCOLUMNS(x0, "Location", LOOKUPVALUE(Table1[Loction],Table1[ModuleID], ?????)
RETURN
x1

 

how can i write the DAX ?

 

 

 

1 ACCEPTED SOLUTION

Okay. Can you try below code now:-

VAR x0 = 
SUMMARIZE (
    FILTER (
        Table1,
        NOT ( Table1[ModuleID] IN VALUES ( 'Table2(remove)'[ModuleID] ) )
    ),
    Table1[ModuleID],
    "SUM_", SUM ( Table1[StatusScore] ),
    "LastSequence", MAX ( Table1[Sequence] ),
    "location",CALCULATE(max(Table1[Location]),Table1[Sequence] = MAX ( Table1[Sequence] ))
)

Output:-

Samarth_18_0-1639043259615.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

6 REPLIES 6
Samarth_18
Community Champion
Community Champion

Hi @ChoiJunghoon ,

 

You can create a custom column in table with below :-

filter =
VAR result =
    CALCULATE (
        FIRSTNONBLANK ( Table1[ModuleID], 1 ),
        FILTER (
            ALL ( 'Table2(remove)' ),
            'Table1'[ModuleID] = 'Table2(remove)'[ModuleID]
        )
    )
RETURN
    IF ( result <> BLANK (), "Remove", "Add" )

 

2. Add all required column and add new filter column as filter :-

image.png

Thanks,

Samarth

 

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Thank you for your reply. 
But I must create the table by using DAX.

Okay, then you can create a table with below dax:-

VAR x0 =
SUMMARIZE (
    FILTER (
        Table1,
        NOT ( Table1[ModuleID] IN VALUES ( 'Table2(remove)'[ModuleID] ) )
    ),
    Table1[ModuleID],
    "SUM_", SUM ( Table1[StatusScore] ),
    "LastSequence", MAX ( Table1[Sequence] ),
    "location", MAX ( Table1[Location] )
)

Output:-

Samarth_18_0-1639037574602.png

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Thank you for your reply. but. 
Location column can not be applied with the "MAX" function. 

Becuase it's not sequencial. 

 

A2  5 D 

 

Could you please check out that. 

Okay. Can you try below code now:-

VAR x0 = 
SUMMARIZE (
    FILTER (
        Table1,
        NOT ( Table1[ModuleID] IN VALUES ( 'Table2(remove)'[ModuleID] ) )
    ),
    Table1[ModuleID],
    "SUM_", SUM ( Table1[StatusScore] ),
    "LastSequence", MAX ( Table1[Sequence] ),
    "location",CALCULATE(max(Table1[Location]),Table1[Sequence] = MAX ( Table1[Sequence] ))
)

Output:-

Samarth_18_0-1639043259615.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Thank you Thank you!!

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

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

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors