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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
roman_gorbunov
Frequent Visitor

Add missing rows to table checking another table

Hallo,

 

There is a table with cash balances by day at the end of the day.

This table skips weekends when the balance of money does not change, and I need the missed days to be filled in as well.

roman_gorbunov_0-1649750684377.png

 

I have tried joining this table with the calendar table with this:

 

Required table =
GENERATEALL (
'Calendar',
VAR CalendarID = 'Calendar'[Date]
RETURN
SELECTCOLUMNS (
CALCULATETABLE ( 'Сash balance ', 'Сash balance '[Date] = CalendarID ),
"Сash balance", 'Сash balance'[balance_sum], "Company", 'Сash balance'[Company]
)
)


But as a result, the weekend is still missed.


What can be done with DAX or M ?

1 ACCEPTED SOLUTION

Thanks a lot, I have modified your formula and its works as required:

cash balance_with weekends =
if(
[cash balance]=blank(),
CALCULATE (
[cash balance],
FILTER (
ALLSELECTED ( 'Calendar' ),
'Calendar'[Date]
= MAXX (
FILTER ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] < MAX ( 'Calendar'[Date]) && [cash balance]<>BLANK() ) , 'Календарь'[Date] )
)
),
[cash balance],
)

View solution in original post

3 REPLIES 3
AllisonKennedy
Community Champion
Community Champion

@roman_gorbunov  Create a table visual with Calendar[Date] in the table and add a measure:

 

Value = 

_lastsaledate = MAXX(FILTER(ALL(cashbalancetable), cashbalancetable[date] <= calendar[date]),  cashbalancetable[date] )

RETURN

MAXX( FILTER(ALL(cashbalancetable), cashbalancetable[date] = _lastsaledate,  cashbalancetable[balance_sum] )


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

amitchandak
Super User
Super User

@roman_gorbunov , try last non Continuous  with help from date table

 

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

 

or

 

CALCULATE(lastnonblankvalues( 'Date'[Date], [sales]) ,filter(ALLSELECTED('Date'),'Date'[Date] =MAX('Date'[Date] ) ) )

 

or

 

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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thanks a lot, I have modified your formula and its works as required:

cash balance_with weekends =
if(
[cash balance]=blank(),
CALCULATE (
[cash balance],
FILTER (
ALLSELECTED ( 'Calendar' ),
'Calendar'[Date]
= MAXX (
FILTER ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] < MAX ( 'Calendar'[Date]) && [cash balance]<>BLANK() ) , 'Календарь'[Date] )
)
),
[cash balance],
)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.

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.