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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
chlimaye
Regular Visitor

Weekly Commulative some divided over 4 weeks in table

Hi All,

 

I want to achieve one condition below for weekly commulative sum of sales.

 

chlimaye_0-1738135256354.png

i want data to be stored in above manner for weekly sales.

 

My cummulative dax function working fine but it only works as week completed and its starts showing the value,  then for next 7 days no data untill it completed the week.

Also i want show data untill previous working day for example.

 

Today is 29 Jan and my data should shown in last week only untill 28 Dec with cummulative manner.

 

VAR _MaxWeekEndDate = MAX(DEMAND_DAY_SUMMARY[Weekend Date])
Var Total=
CALCULATE(
    SUM('DEMAND_DAY_SUMMARY'[BASE_ACTUAL_DELIVERED_QUANTITY]),
    DEMAND_DAY_SUMMARY[FORECAST_SUBMISSION_YEAR_MONTH_NUMBER]=FORMAT(EOMONTH(SELECTEDVALUE(DEMAND_DAY_SUMMARY[MYT]),0),"YYYYMM"),
    FILTER(
        ALLEXCEPT('DEMAND_DAY_SUMMARY',DEMAND_DAY_SUMMARY[Therapy Area],DEMAND_DAY_SUMMARY[Market],
        DEMAND_DAY_SUMMARY[Global Code],DEMAND_DAY_SUMMARY[Brand]),
        'DEMAND_DAY_SUMMARY'[Year] = MAX('DEMAND_DAY_SUMMARY'[Year]) &&
        'DEMAND_DAY_SUMMARY'[Month] = MAX('DEMAND_DAY_SUMMARY'[Month]) &&
        'DEMAND_DAY_SUMMARY'[Weekend Date] <= MAX(DEMAND_DAY_SUMMARY[Weekend Date]) &&
     --   'DEMAND_DAY_SUMMARY'[Date]<=_MaxWeekEndDate &&
        'DEMAND_DAY_SUMMARY'[Date] <= UTCTODAY()-1
    )
   )
   RETURN IF(MAX(DEMAND_DAY_SUMMARY[Date])>=UTCTODAY()-1,0,Total)
 
Please help
4 REPLIES 4
Anonymous
Not applicable

Hi @chlimaye 

 

What's your expected outcome, could you please provide more raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples? It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

 

Best Regards

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

bhanu_gautam
Super User
Super User

@chlimaye Try using

VAR _MaxWeekEndDate = MAX(DEMAND_DAY_SUMMARY[Weekend Date])
VAR Total =
CALCULATE(
SUM('DEMAND_DAY_SUMMARY'[BASE_ACTUAL_DELIVERED_QUANTITY]),
DEMAND_DAY_SUMMARY[FORECAST_SUBMISSION_YEAR_MONTH_NUMBER] = FORMAT(EOMONTH(SELECTEDVALUE(DEMAND_DAY_SUMMARY[MYT]), 0), "YYYYMM"),
FILTER(
ALLEXCEPT('DEMAND_DAY_SUMMARY', DEMAND_DAY_SUMMARY[Therapy Area], DEMAND_DAY_SUMMARY[Market], DEMAND_DAY_SUMMARY[Global Code], DEMAND_DAY_SUMMARY[Brand]),
'DEMAND_DAY_SUMMARY'[Year] = MAX('DEMAND_DAY_SUMMARY'[Year]) &&
'DEMAND_DAY_SUMMARY'[Month] = MAX('DEMAND_DAY_SUMMARY'[Month]) &&
'DEMAND_DAY_SUMMARY'[Weekend Date] <= _MaxWeekEndDate &&
'DEMAND_DAY_SUMMARY'[Date] <= UTCTODAY() - 1
)
)
RETURN IF(MAX(DEMAND_DAY_SUMMARY[Date]) >= UTCTODAY() - 1, 0, Total)




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






can you please let me know , what did you change?

can you please tell me what changes you have done?

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

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