0
votes

I'm new in dax and power pivot.

I have a fact table with store rest on each date and standart dates hierarchy. I want to show rest on first date in period and try to use FISTDATE fuction (see image) enter image description here

If StoreCount value on first date in period > 0 - it works great. But if it's 0 or empty - Excel show me the fist not empty value, but I need to see 0. enter image description here

enter image description here

1

1 Answers

0
votes

If I understand your model correctly, your fact table simply does not have records for 'AG 1046 CF' for the dates prior to April 14th. If so, the first available date is 04/14, which gives you 300. You can fix this issue in 2 ways:

Instead of using

FIRSTDATE('Остатки на складе'[Date])

use

FIRSTDATE('Календарь'[Date])

where 'Календарь' is your calendar table with continuous dates (I assume you have one - if you don't, you will need to add it to the model).

Alternatively, you can make sure that your fact table contains records for each product for each day of the month, even if the balance is zero.

Personally, I would do both. I would have a proper calendar table in my model, and enforce the presence of inventory balances for each product for each day of the month. Your model might look like this:

enter image description here

Image and more info are from this article