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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Fill empty values in table

Hi,

 

I have a problem with non-listed values in a table. I have a standard timeDimension and a table with orders:

Order DateArticle NumberStockOrdered Amount
01.02.20211220020
02.02.20211218050
05.02.20211213010
06.02.20211212030

 

As you can see there are no orders on 03.02.2021 and 04.02.2021. What I need is this:

Order DateArticle NumberStockOrdered Amount
01.02.20211220020
02.02.20211218050
03.02.2021121300
04.02.2021121300
05.02.20211213010
06.02.20211212030

 

It is way more complicated than it seems. 
I am open to any solutions, whether with M, Dax, or a new table structure.

 

Thanks for your help!

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

@Anonymous 

Here is one way. First the model:

model.JPG

 

now create the following measures:

1) Simple sums for stock and orders

2) The initial stock for an article:

Starting stock =
VAR StartDate =
    CALCULATE (
        FIRSTDATE ( 'Date Table'[Date] ),
        ALLEXCEPT ( FactTable, FactTable[Article Number] )
    )
RETURN
    CALCULATE (
        [Sum of Stock],
        FILTER ( ALL ( 'Date Table' ), 'Date Table'[Date] = StartDate )
    )

3) the cumulative orders:

Cumulative Orders =
CALCULATE (
    [Sum of order],
    FILTER (
        ALL ( 'Date Table' ),
        'Date Table'[Date] <= MAX ( 'Date Table'[Date] )
    )
)

4) the running stock value:

Running Stock =
CALCULATE (
    [Starting stock] - [Cumulative Orders],
    DATEADD ( 'Date Table'[Date], -1, DAY )
)

all of which are seen in the following table:calculations.JPG

and finally delete the unnecessary fields from the visual:result.JPG

(if you'd rather see 0 instead of blanks for sum of orders, simply add a 0 in the measure):

 

Sum of order = SUM(FactTable[Ordered Amount]) + 0

 

I've attached the sample PBIX for your reference





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi@Anonymous,

 

Nice day ! Has your problem been solved? if so, please consider Accept a correct reply as the solution to help others find it.
 

Best Regards,

Caitlyn Yan

 

 

stevedep
Memorable Member
Memorable Member

Suppose you are looking for a running total?

stevedep_0-1614284295190.png

 

File is attached.

Kind regards, Steve. 

 

PaulDBrown
Community Champion
Community Champion

@Anonymous 

Here is one way. First the model:

model.JPG

 

now create the following measures:

1) Simple sums for stock and orders

2) The initial stock for an article:

Starting stock =
VAR StartDate =
    CALCULATE (
        FIRSTDATE ( 'Date Table'[Date] ),
        ALLEXCEPT ( FactTable, FactTable[Article Number] )
    )
RETURN
    CALCULATE (
        [Sum of Stock],
        FILTER ( ALL ( 'Date Table' ), 'Date Table'[Date] = StartDate )
    )

3) the cumulative orders:

Cumulative Orders =
CALCULATE (
    [Sum of order],
    FILTER (
        ALL ( 'Date Table' ),
        'Date Table'[Date] <= MAX ( 'Date Table'[Date] )
    )
)

4) the running stock value:

Running Stock =
CALCULATE (
    [Starting stock] - [Cumulative Orders],
    DATEADD ( 'Date Table'[Date], -1, DAY )
)

all of which are seen in the following table:calculations.JPG

and finally delete the unnecessary fields from the visual:result.JPG

(if you'd rather see 0 instead of blanks for sum of orders, simply add a 0 in the measure):

 

Sum of order = SUM(FactTable[Ordered Amount]) + 0

 

I've attached the sample PBIX for your reference





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Anonymous
Not applicable

Thank you PaulDBrown! This was what I needed! Had to change some little things but all in all thats it!

BA_Pete
Super User
Super User

Hi @Anonymous ,

 

Create a measure to display your [Ordered Amount] value like this:

 

 

_yourAmount = SUM(yourTable[Ordered Amount]) + 0

 

 

This will show you zeroes where no other value exists.

 

If you don't want the zeroes, you can right-click on any of your displayed dimensions and check 'Show items with no data':

BA_Pete_0-1614098251273.png 

 

However, note that this will show ALL values available in the dimensions, so may not be suitable for your use-case.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Anonymous
Not applicable

Hi Pete,
Thanks for your reply, but unfortunately this isn't what I need.  
Selecting "Show items with no data" leaves all values empty except the date.

The measure just adds rows with same date as order date but with zeros.

lh_2020

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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