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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
Seabastein
Frequent Visitor

Unpivot without keeping zeros

Hello,

I have a table with articles and the quantities sold are in different column for each month of the year.

When i unpivot them I obtain a quantity of rows containing only zeros and wanted to know if there is a way to filter them during the process, since I tried to filter them afterwards and ended up with 30 minutes wait for it to load into the model.

 

The table before

Seabastein_0-1634303515789.png

 

 

Here is what it looks like afterwards with the code

 

= Table.Unpivot(#"Colonnes permutées", {"Qte Janvier", "Qte Février", "Qte Mars", "Qte Avril", "Qte Mai", "Qte Juin", "Qte Juillet", "Qte Août", "Qte Septembre", "Qte Octobre", "Qte Novembre", "Qte Décembre"}, "Attribut", "Valeur")

 

 

 

Seabastein_2-1634306915198.png

 

Thanks in advance for the help 👍

Sebastien

 

 

1 ACCEPTED SOLUTION
speedramps
Community Champion
Community Champion

Please consider this solution and click the thumbs up icon for me just trying to help you and click ACCEPT SOLUTION if it fixes your problem. Thank you ! 

 

Option 1)

Go back to the data sorce (eg SQL view) and send the data will null instead of 0.

The unpivot will then run much faster.

 

Option 2)

Select columns Jan to Dec and replace 0 with null before doing the unpivot 

View solution in original post

2 REPLIES 2
speedramps
Community Champion
Community Champion

Please consider this solution and click the thumbs up icon for me just trying to help you and click ACCEPT SOLUTION if it fixes your problem. Thank you ! 

 

Option 1)

Go back to the data sorce (eg SQL view) and send the data will null instead of 0.

The unpivot will then run much faster.

 

Option 2)

Select columns Jan to Dec and replace 0 with null before doing the unpivot 

AlexisOlson
Super User
Super User

I think if you replace 0 with null in all of the columns you intend to unpivot, then those values won't show up after unpivoting.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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