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
powerbricco
Advocate I
Advocate I

PQ Transformation

Dear All,

I have the following table in PowerQuery:

DateValue
15/01/2025null
14/01/2025null
13/01/2025null
12/01/2025null
11/01/2025null
10/01/2025null
09/01/2025null
08/01/2025null
07/01/2025null
06/01/2025null
05/01/2025null
04/01/2025null
03/01/2025null
02/01/2025null
01/01/2025null
null766,97
null765,48
null613,73
null1453,6
null1100,58
null1000,02
null950,54
null746,31
null924,9
null669,48
null844,7
null1280,44
null927,59
null1231,85
null634,31
15/02/2025null
14/02/2025null
13/02/2025null
12/02/2025null
11/02/2025null
10/02/2025null
09/02/2025null
08/02/2025null
07/02/2025null
06/02/2025null
05/02/2025null
04/02/2025null
03/02/2025null
02/02/2025null
01/02/2025null
null757,68
null701,98
null1260,99
null360,49
null867,07
null860,66
null978,51
null1077,89
null1084,86
null941,76
null775,19
null858,75
null654,13
null1549,75
null1145,56

 

My desired result is the following:

DateValue
15/01/2025766,97
14/01/2025765,48
13/01/2025613,73
12/01/20251453,6
11/01/20251100,58
10/01/20251000,02
09/01/2025950,54
08/01/2025746,31
07/01/2025924,9
06/01/2025669,48
05/01/2025844,7
04/01/20251280,44
03/01/2025927,59
02/01/20251231,85
01/01/2025634,31
15/02/2025757,68
14/02/2025701,98
13/02/20251260,99
12/02/2025360,49
11/02/2025867,07
10/02/2025860,66
09/02/2025978,51
08/02/20251077,89
07/02/20251084,86
06/02/2025941,76
05/02/2025775,19
04/02/2025858,75
03/02/2025654,13
02/02/20251549,75
01/02/20251145,56

 

What I've done is matching every date with its value by eliminating the first 15 rows of nulls in the Value column. 

I don't know how to do this in powerquery..

 

1 ACCEPTED SOLUTION
speedramps
Super User
Super User

I am not a AI response.

Please try this method which i have tested ...
Reference yourdata to create a new table called "dates"
Remove any rows from "dates" that have nulls

Then add a index column

 

speedramps_0-1749552084559.png

speedramps_1-1749552114502.png

 

speedramps_2-1749552179792.png

 

Then do the same kind of thingsto create a "values" tables

 

So you now have 2 tables

 

speedramps_3-1749552224172.pngspeedramps_4-1749552234555.png

Merge the tables using the index to create another table

speedramps_5-1749552307946.png

 

Expand the table

speedramps_6-1749552370871.png

 

 

 Congratultaions ... you have your answer

speedramps_7-1749552397939.png

 

 

 

Merge the tables



 

View solution in original post

5 REPLIES 5
speedramps
Super User
Super User

@burakkaragoz 

Are you just repling with AI generated answers?

You seem to copy and paste answer to previous similare question which do not work for the current question being asked.  😀😀😀

speedramps
Super User
Super User

I am not a AI response.

Please try this method which i have tested ...
Reference yourdata to create a new table called "dates"
Remove any rows from "dates" that have nulls

Then add a index column

 

speedramps_0-1749552084559.png

speedramps_1-1749552114502.png

 

speedramps_2-1749552179792.png

 

Then do the same kind of thingsto create a "values" tables

 

So you now have 2 tables

 

speedramps_3-1749552224172.pngspeedramps_4-1749552234555.png

Merge the tables using the index to create another table

speedramps_5-1749552307946.png

 

Expand the table

speedramps_6-1749552370871.png

 

 

 Congratultaions ... you have your answer

speedramps_7-1749552397939.png

 

 

 

Merge the tables



 

burakkaragoz
Community Champion
Community Champion

Hi @powerbricco ,

 

You can achieve your desired result in Power Query by filtering out the rows where the "Value" column is null. Here’s how you can do it:

  1. Open Power Query Editor.
  2. Select the "Value" column.
  3. Go to the top menu and click on "Remove Rows" > "Remove Blank Rows".
    • Alternatively, right-click on the column header and choose "Remove Empty".
  4. If you want more control (for example, if sometimes there are other nulls you want to keep), you can use the filter dropdown on the "Value" column and uncheck "(null)" to filter them out.

After applying this step, only the rows with actual values in the "Value" column (and their corresponding dates) will remain, just like your desired result.

If you want the equivalent M code:

m
 
= Table.SelectRows(YourTableName, each [Value] <> null)

Replace "YourTableName" with the actual name of your previous step.

Let me know if you need a more detailed step-by-step or further customization!
translation and formatting supported by AI

It does not work cause if i remove the nulls in Value column, it deletes the row with the dates in Date column...

@powerbricco ,

Thanks for your feedback! If removing nulls in the Value column deletes the rows with dates in the Date column as well, it’s because those date values are only present in the upper rows, and the rest are null.
To fix this, you should first "Fill Down" the Date column so that each row has a date. Then you can filter out the rows where Value is null.

Here’s how:

  1. Select the Date column in Power Query.
  2. Go to Transform > Fill > Down.
    This will fill the date down into all the null cells.
  3. Now remove the rows where Value is null.

M code example:

m
 
FilledDown = Table.FillDown(YourPreviousStep, {"Date"}),
Result = Table.SelectRows(FilledDown, each [Value] <> null)

Let me know if you need a more detailed step-by-step!
translation and formatting supported by AI

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.