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
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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.