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

How to prevent null values from loading into data model when importing data from cube with MDX query

How can I remove the null row from my MDX query results OR prevent null values from loading into my data model? 

 

I'd prefer to prevent these records from loading rather than filtering out null values because the null values make my data source much larger than it needs to be. 

 

Here is the query I'm currently working with

 

 

 select
    non empty 
    {
[Measures].[Average Trips Per Day]
,[Measures].[Calories Burned]
,[Measures].[Carbon Offset]
,[Measures].[Median Distance]
,[Measures].[Median Duration]
,[Measures].[Rider Trips]
,[Measures].[Rides Per Bike Per Day]
,[Measures].[Total Distance]
,[Measures].[Total Riders]
,[Measures].[Total Trip Duration in Minutes]
,[Measures].[Total Members]
    } on columns
    ,
    non empty 
    {
    (
    [Promotion].[Promotion Code Name].children
)
    } on rows 
from [BCycle]
where ([Program].[Program Name].&[Madison B-cycle])

 

When I run this query, I still get a row for Promotion Code Name = NULL; I want to exclude that row but cannot figure out how. Any advice or help you can provide would be much appreciated!  

1 ACCEPTED SOLUTION

Did you try removing Empty rows from Power Query (keeping your original MDX)?

View solution in original post

8 REPLIES 8
AkhilAshok
Solution Sage
Solution Sage

You could simply exclude the nulls from the MDX itself:

 

non empty 
{
(
[Promotion].[Promotion Code Name].children - [Promotion].[Promotion Code Name].&
)
} on rows

 

You can also do this in Power Query filter. But since you already have an MDX code, it is better to do direclty in MDX.

Anonymous
Not applicable

Thanks for the suggestion. I tried adding that to my query & running in SSMS. I get a memory error very quickly & I'm thinking its because my data source is so large?

 

Do you have any other suggestions? 

 

Is there a way I can remove the rows with a power query filter? I'd prefer to "hard delete" these rows, not hide them. 

 

Many thanks!

Anonymous
Not applicable

I tried adding that to my MDX query in power bi & I got this error. Would you be able to assist?2018-11-27_1456.png

Did you try removing Empty rows from Power Query (keeping your original MDX)?

Anonymous
Not applicable

Yepp, that worked! So that means as my data refreshes, it will pull in everything & then filter it to non-null values?

Hi @Anonymous,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Yes, thank you for your insight. It is much appreciated. 

You can just click on the drop down besides the Product Code Name column in Power Query editor and press Remove Empty. You can consider this as 'hard delete' since null vlaues won't be loaded to your data model.

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.