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
Sathvik123
Helper V
Helper V

dynamically calculate week to dates sales

Hello All,

 

I have a report where I am having daily dates and sales.

My requirement is I need to show week to date sales dynamically.

If the end user runs the report today I need to show 26,27 and 28 sales sum   ( 800)

If the end user runs report tomorrow then I need to show 26,27, 28  and 29th sales sum 

 

Could any one please help how to do.

 

Date                              Sales

21/11/2023100
22/11/2023200
23/11/2023300
24/11/2023600
25/11/2023200
26/11/2023100
27/11/2023500
28/11/2023200
  
  
  
  
output : 
wtd sales800
4 REPLIES 4
Sahir_Maharaj
Super User
Super User

Hello @Sathvik123,

 

Can you please try this DAX:

WTD Sales = 
CALCULATE(
    SUM(TableName[Sales]), 
    FILTER(
        TableName,
        TableName[Date] >= STARTOFWEEK(TODAY()) && 
        TableName[Date] <= TODAY()
    )
)

 

Should you have any questions, please do not hesitate to reach out to me.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution?
➤ Lets connect on LinkedIn: Join my network of 13K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Hi @Sahir_Maharaj ,

 

Thanks for your respense.

Since I have lot of measures in my report I need only wtd calculation so that I can keep in filters and select true.Then all the measures will change based on calculation

 

Can you please change your calculation to give the wtd instead of calculation sales for wtd

miTutorials
Super User
Super User

PijushRoy
Super User
Super User

@Sathvik123 

What is the Logic, you need to show the last 3 days' data or the last 4 days' data
In your 1st Example, you are showing last 3 days data
In 2nd example, you are showing last 4 days data
I am not clear about the logic.

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.