SQLfun
SQLfun

Reputation: 53

Dax Time Intelligence how to calculate current week Sales

I Would like to to calculate this week sales using DAX(Current week sales) (Latest week) Starting from Monday to the latest day of the current week/latest week.

I have attached pbix file https://app.box.com/s/ah11tcvbq45rlc5pujunxkfloyd4x7cu

Total Sales $392enter image description here

Upvotes: 1

Views: 3668

Answers (2)

David Browne - Microsoft
David Browne - Microsoft

Reputation: 88996

A simple WTD measure would look something like this:

Sales WTD = 
    calculate(sum(CountrySales[Sale]),
                    filter(all('Date'), 'Date'[Date] <= max('Date'[Date]) 
                                     && 'Date'[WeekNum] = max('Date'[WeekNum])))

You can read all about the calculate function online, watch videos, and there's a whole chapter devoted to it in The Definitive Guide to Dax.

Upvotes: 1

Aldert
Aldert

Reputation: 4313

Create a new visual table, drag your WeekNum and Sale in the table. Select the combobox of the Weeknum and select: Don't summarize. End result as below:

enter image description here

Upvotes: 1

Related Questions