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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Simply query DAX - IF null...

HI,

 

I have problem with this: 

Column2 = if('merge1'[Components.name]; "1";"0")
 
I get info:
You cannot create a single value for the 'Components.name' column in the 'merge1' table. This may include the fact that the calculation formula refers to a table containing multiple values without aggregation summaries, takes into account how the minimum value, maximum value, number or sum can involve the use of a single result.
 
I changed this query to this:
"Column2 = if(ISBLANK(COUNTBLANK('merge1'[Components.name])); "1";"0")"
 
But I can't add it to the filter.
 
An effect that I would like to get.
 
Components.name | Column2
null              | 0
Adobe             | 1
Windows           | 1
null              | 0
 
May I ask you for help?
2 ACCEPTED SOLUTIONS
AlB
Community Champion
Community Champion

Hi @Anonymous 

Perhaps

Column2 = IF (ISBLANK('merge1'[Components.name]); "1"; "0" )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

View solution in original post

v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

It seems you create a measure not a column, so it throw the error.

If you create a measure below, it can be right.

but if the [Components.name] column is of text type, null value doesn't mean to be blank, it is a "null" text value.

you can create a measure like

Measure = if(MAX('Table'[Components.name])<>"null", "1","0")

Capture10.JPG

Capture11.JPG

But measures can't be added into slicer, it just can be added into visual level filter.

To create a column and add it into a slicer,

Column = if('Table'[Components.name]<>"null", "1","0")

or 
Column = if(ISBLANK('Table'[Components.name]), "0","1")

Capture12.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

It seems you create a measure not a column, so it throw the error.

If you create a measure below, it can be right.

but if the [Components.name] column is of text type, null value doesn't mean to be blank, it is a "null" text value.

you can create a measure like

Measure = if(MAX('Table'[Components.name])<>"null", "1","0")

Capture10.JPG

Capture11.JPG

But measures can't be added into slicer, it just can be added into visual level filter.

To create a column and add it into a slicer,

Column = if('Table'[Components.name]<>"null", "1","0")

or 
Column = if(ISBLANK('Table'[Components.name]), "0","1")

Capture12.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

AlB
Community Champion
Community Champion

Hi @Anonymous 

Perhaps

Column2 = IF (ISBLANK('merge1'[Components.name]); "1"; "0" )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

@Anonymous please post a sample of your data and your expected result. Also be specific about where you are doing this. To @AlB 's point, DAX for columns and measures is different becuase the former uses row context and the latter uses filter context, two totally different things. Formulas perfectly valid in one will fail in the other.

How to get good help fast. Help us help you.
How to Get Your Question Answered Quickly
How to provide sample data in the Power BI Forum



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
Anonymous
Not applicable

HI @AlB 

 

I get information

"You cannot specify a single value for the 'Components.name' column in the 'merge1' table. This may be due to the fact that the measurement formula refers to a column containing many values without a specific aggregation, such as a minimum value, maximum value, number or sum, allowing to obtain a single result."

AlB
Community Champion
Community Champion

Hi @Anonymous 

Are you creating a calculated column or a measure?? That sounds like the message you would get when creating a measure. It should be fine with a calculated column

Please mark the question solved when done and consider giving kudos if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

 

SU18_powerbi_badge

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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