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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Bimo
New Member

fillin gaps

Hello 

I have data like 

 

02/01/2021  3
15/02/2021  5
05/04/2021  6

and I would like then to fill in gaps in dates to show as per below 

 

Thanks 

 

02/01/2021  3
03/01/2021  3
04/01/2021  3
08/01/2021  3
09/01/2021 3
10/01/2021 3
 
 
 
 
14/02/2021  3
15/02/2021  5
 
 
 
 
05/04/2021  6
06/04/2021  6
07/04/2021  6

 

1 ACCEPTED SOLUTION
negi007
Community Champion
Community Champion

@Bimo so i have tried to solve your issue

1. so this is your table data. i have named it facts table in my model

negi007_0-1638003871345.png

2. You can create a table having all date values from first date till last date in your data table. i have named it calendar table in my model.

below code will create table for you

calendar = CALENDAR(FIRSTDATE(facts[date]),LASTDATE(facts[date]))
 
3. then you add another column to your calendar table by looking up value from facts table against available dates
value = LOOKUPVALUE(facts[value],facts[date],'calendar'[Date])
 
4. then you create another column to fill blank places using below code
Value2 =
VAR CurrentVal = 'calendar'[value]
VAR CurrentDate = 'calendar'[Date]
VAR LastDateWithValue =
CALCULATE (
MAX ( 'calendar'[Date] ),
FILTER (
'calendar',
'calendar'[value] <> BLANK ()
 
&& 'calendar'[Date] <= CurrentDate
)
)
RETURN
//LastDateWithValue
CALCULATE (
SUM('calendar'[value]) ,
FILTER (
'calendar',
'calendar'[Date] = LastDateWithValue
)
)
 
below is final output that you were looking for
 
negi007_1-1638004126077.png

 

i have taken som inspiration from this post to solve your problem
 

i am attaching pbix file as well for your reference.

 

do let me know if it resolve your problem. thanks

 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

View solution in original post

2 REPLIES 2
negi007
Community Champion
Community Champion

@Bimo so i have tried to solve your issue

1. so this is your table data. i have named it facts table in my model

negi007_0-1638003871345.png

2. You can create a table having all date values from first date till last date in your data table. i have named it calendar table in my model.

below code will create table for you

calendar = CALENDAR(FIRSTDATE(facts[date]),LASTDATE(facts[date]))
 
3. then you add another column to your calendar table by looking up value from facts table against available dates
value = LOOKUPVALUE(facts[value],facts[date],'calendar'[Date])
 
4. then you create another column to fill blank places using below code
Value2 =
VAR CurrentVal = 'calendar'[value]
VAR CurrentDate = 'calendar'[Date]
VAR LastDateWithValue =
CALCULATE (
MAX ( 'calendar'[Date] ),
FILTER (
'calendar',
'calendar'[value] <> BLANK ()
 
&& 'calendar'[Date] <= CurrentDate
)
)
RETURN
//LastDateWithValue
CALCULATE (
SUM('calendar'[value]) ,
FILTER (
'calendar',
'calendar'[Date] = LastDateWithValue
)
)
 
below is final output that you were looking for
 
negi007_1-1638004126077.png

 

i have taken som inspiration from this post to solve your problem
 

i am attaching pbix file as well for your reference.

 

do let me know if it resolve your problem. thanks

 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

it works! Thanks

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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