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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
HKIndia
Helper I
Helper I

3 weeks start and end date except current week based on weekending slicer

Hi All,

Please help..!

 

Need help with calculating "last3WeeksTotal" based on the selected Weekending date in the slicer. The formula I provided is showing blank results:

 

I have applied below DAX but it showing blank result :- 

3Wkstotal =
CALCULATE(
    SUM('Date_set'[Revenue]),
    FILTER('Date_set',
    'Date_set'[Order Stage] = "Ordered"
    &&'Date_set'[Scope] = "Order"
    ),FILTER('CalendarDate','CalendarDate'[Date]>=[Selected_date]-27 && 'CalendarDate'[Date]<=[Selected_date]-7))

 

Report link below:

https://www.dropbox.com/s/6jvwyryae34ormg/3Weeks%20Total%20issue.pbix?dl=0 

HKIndia_0-1690266652728.png

 

HKIndia_1-1690266712433.png

 

Any suggestions or corrections are welcome!

 

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User

pls try this

 

3Wkstotal = 
 VAR _dateselected = [Selected_date]
 VAR _Results =//Monday = 2,Tuesday = 3, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7 
CALCULATE(
    SUM('Date_set'[Revenue]),
    ('Date_set'[Order Stage] ,
    'Date_set'[Scope])   in {( "Ordered","Order")}, REMOVEFILTERS(CalendarDate),   DATESBETWEEN('CalendarDate'[Date], _dateselected-27,_dateselected-7))
 RETURN
_Results
-----------------or --------------
3Wkstotal = 
 VAR _dateselected = [Selected_date]
 VAR _Results =//Monday = 2,Tuesday = 3, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7 
CALCULATE(
    SUM('Date_set'[Revenue]),
    ('Date_set'[Order Stage] ,
    'Date_set'[Scope])   in {( "Ordered","Order")},   DATESBETWEEN('CalendarDate'[Date], _dateselected-27,_dateselected-7))
 RETURN
_Results

 

View solution in original post

4 REPLIES 4
Ahmedx
Super User
Super User

pls try this

 

3Wkstotal = 
 VAR _dateselected = [Selected_date]
 VAR _Results =//Monday = 2,Tuesday = 3, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7 
CALCULATE(
    SUM('Date_set'[Revenue]),
    ('Date_set'[Order Stage] ,
    'Date_set'[Scope])   in {( "Ordered","Order")}, REMOVEFILTERS(CalendarDate),   DATESBETWEEN('CalendarDate'[Date], _dateselected-27,_dateselected-7))
 RETURN
_Results
-----------------or --------------
3Wkstotal = 
 VAR _dateselected = [Selected_date]
 VAR _Results =//Monday = 2,Tuesday = 3, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7 
CALCULATE(
    SUM('Date_set'[Revenue]),
    ('Date_set'[Order Stage] ,
    'Date_set'[Scope])   in {( "Ordered","Order")},   DATESBETWEEN('CalendarDate'[Date], _dateselected-27,_dateselected-7))
 RETURN
_Results

 

@Ahmedx  Thank you so much, I am about to accept this as solution however i have just a little query, we are summing revenue currentrly right, but if I want to apply average function. it shows wrong result.

 

HKIndia_1-1690301148697.png

 

How we can achive 4552 when we use Average funtion instead of sum. Please suggest.

 

it's complicated, but try writing another measure like this

fexed =
var _tbl =
SUMMARIZE('Date_set','Date_set'[Business Unit])

RETURN
SUMX(_tbl,[3WksAvgNew])

Thi @Ahmedx  Thank you for replying!

 

But it is showing blank after applying this measure.! as It seems too comlicated. Thanks for trying!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.