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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
crispybc
Frequent Visitor

Filling blank dates with previous values

I have the following tables:

crispybc_1-1640768567580.png

My goal is that I need to see the STATUS and ASSIGNEE_ID of an ID at any given date after the CREATED_DATE

 

I have the following DAX:

 

 

Test = VAR currentDate = MAX('Date_Table'[Date])
RETURN
    CALCULATE (
        COUNTROWS ( History ),
        FILTER (
            History,
            History[UPDATED_AT] = CALCULATE(MAX(History[UPDATED_AT]),History[UPDATED_DATE] = currentDate, GROUPBY(History,History[ID]))                       
        )
    )

 

 

However this obviously can't count rows that don't exists. I would like to fill in the blank dates (dates where no UPDATE_DATE exists for an ID) using the previous row values. For example the below should have all the ampty dates filled.

crispybc_0-1640768150821.png

Need some guidance on how to go about this, I think maybe countrows may not be the right way, however I would like to still be able to filter the visualisations on the status/assigne_id

2 REPLIES 2
v-stephen-msft
Community Support
Community Support

Hi @crispybc ,

 

Here's my solution.

Sample data

vstephenmsft_0-1641202356479.png

 

1.Create the calendar table named 'Date_Table'.

Date_Table = CALENDAR(MIN('History'[UPDATED_AT]),MAX('History'[UPDATED_AT]))

vstephenmsft_1-1641202406545.png

vstephenmsft_2-1641202417159.png

 

2.Create the first measure to count rows.

Measure = COUNTROWS('History')

 

3.Create the second measure to fill blank values.

Measure_Filldown =
VAR _date =
    CALCULATE (
        MAX ( 'Date_Table'[Date] ),
        FILTER (
            ALL ( 'Date_Table' ),
            [Date] <= MAX ( 'Date_Table'[Date] )
                && [Measure] <> BLANK ()
        )
    )
RETURN
    CALCULATE ( [Measure], FILTER ( ALL ( 'Date_Table' ), [Date] = _date ) )

 

4.The result.

vstephenmsft_3-1641202663557.png

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@crispybc ,The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

 

I think you need Last Day Non Continuous  and take coalease with current day date

Last Day Non Continuous = CALCULATE([sales],filter(ALLSELECTED('Date'),'Date'[Date] =MAXX(FILTER(ALLSELECTED('Date'),'Date'[Date]<max('Date'[Date])),'Date'[Date])))

 

Day Intelligence - Last day, last non continous day
https://medium.com/@amitchandak.1978/power-bi-day-intelligence-questions-time-intelligence-5-5-5c324...

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.