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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

How to perform IF operation to a column of a table generated in DAX?

Hi, I have table generated by using following DAX 

Sub_Table = 
VAR _Table =
SUMMARIZE(
[ID],
[Date],
"Values", SUM(Table1[Values])
)

 

I want to perform following IF operation in the VAR _Table

IF(_Table[Values] <=0, 0, _Table[Values])

And then RETURN an output Table. Any help will be appreciated!

NOTE: I do not mind adding a new conditional column if that makes solution easier. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

SUMMARIZE (<table>, <groupBy_columnName>[, <groupBy_columnName>]…[, <name>, <expression>]…)

The first parameter of the SUMMARIZE function should be the table name.

SUMMARIZE function 

 

You can think of SUM ( Table1[Values] ) as a whole:

VAR _Table =
    SUMMARIZE (
        'Table1',
        'Table1'[ID],
        'Table1'[Date],
        "Values", IF ( SUM ( Table1[Values] ) <= 0, 0, SUM ( Table1[Values] ) )
    )

If you want to keep [Values] in the virtual table and add a new column.

VAR _Table =
    SUMMARIZE (
        'Table1',
        'Table1'[ID],
        'Table1'[Date],
        "Values1", SUM ( Table1[Values] ),
        "Values2", IF ( SUM ( Table1[Values] ) <= 0, 0, SUM ( Table1[Values] ) )
    )

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Anonymous ,

 

SUMMARIZE (<table>, <groupBy_columnName>[, <groupBy_columnName>]…[, <name>, <expression>]…)

The first parameter of the SUMMARIZE function should be the table name.

SUMMARIZE function 

 

You can think of SUM ( Table1[Values] ) as a whole:

VAR _Table =
    SUMMARIZE (
        'Table1',
        'Table1'[ID],
        'Table1'[Date],
        "Values", IF ( SUM ( Table1[Values] ) <= 0, 0, SUM ( Table1[Values] ) )
    )

If you want to keep [Values] in the virtual table and add a new column.

VAR _Table =
    SUMMARIZE (
        'Table1',
        'Table1'[ID],
        'Table1'[Date],
        "Values1", SUM ( Table1[Values] ),
        "Values2", IF ( SUM ( Table1[Values] ) <= 0, 0, SUM ( Table1[Values] ) )
    )

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

ToddChitt
Super User
Super User

Treat the table like any other. Simply add that column after the table has been created. 

Am I missing somthing?

And why the whole VAR / Return thing? Is this part of a larger calculation?




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Anonymous
Not applicable

Yes, it is a part of larger calculation. So, I have to perform this calculation before UNIONize with other tables in same DAX 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors