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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ViktoriaRv
Regular Visitor

How to copy weekends to correctly calculate the average balance

Hi,
I have a balance of accounts for every working day. But there's no balance for the weekend, holliday
08.09.22   200 000
09.09.22    205 000
10.09.22     day off
11.09.22    day off
12.09.22      203 200

This balance for each account


How to copy weekends to correctly calculate the average balance.  I have an array of 1 million entries

Thss is  code does not work if the balance = 0 for the working day, it is duplicated further, but I don’t need this

Balance all date =
VAR currentDate =  MAX ('Date'[Date])
VAR LNBDate = CALCULATE ( LASTNONBLANK ( 'Date'[Date]; CALCULATE ( COUNTROWS ( 'Файлы' ) ) );
FILTER ( ALL ( 'Date'[Date]); 'Date'[Date]<= currentDate )
)
RETURN
CALCULATE ( (DIVIDE( Sumx('Файлы';'Файлы'[Balance]*RELATED(MAP_Lite[Знак (т070, т071)]));100000));
FILTER ( ALL ('Date');  'Date'[Date]= LNBDate )
)

 

There may be such a situation
08.09.22   200 000
09.09.22    205 000
10.09.22     day off
11.09.22    day off
12.09.22      0.00

13.09.22      203 000

 

should be

08.09.22   200 000
09.09.22    205 000
10.09.22     day off  205 000
11.09.22    day off  205 000
12.09.22      0.00

13.09.22      203 000

 

 

3 REPLIES 3
ViktoriaRv
Regular Visitor

It's not just the weekend.
sometimes weekends are working days.

amitchandak
Super User
Super User

@ViktoriaRv , check if this code can help little bit -https://amitchandak.medium.com/power-bi-show-weekend-data-on-monday-or-friday-dab5ee201f0e

It's not just the weekend.
sometimes weekends are working days.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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