Forum Discussion
Getting Value Sum from previous week
- 9 years ago
Sorry Mistake is my side.
Try this
Pre Sales =
var End_Date = MIN('Week Sales'[StartOfWeek]) -1
var Start_Date = End_Date - 6
return
CALCULATE(SUM('Week Sales'[Sales]),DATESBETWEEN('Week Sales'[Date],Start_Date,End_Date),ALLSELECTED('Week Sales'[StartOfWeek]))Small Change in your already existing formula .
Change ALLExcpet into ALLSelected, It should work
If not let me know dude.
I believe so, the Date table is made by Power bi with calendar funcation.
Sorry Mistake is my side.
Try this
Pre Sales =
var End_Date = MIN('Week Sales'[StartOfWeek]) -1
var Start_Date = End_Date - 6
return
CALCULATE(SUM('Week Sales'[Sales]),DATESBETWEEN('Week Sales'[Date],Start_Date,End_Date),ALLSELECTED('Week Sales'[StartOfWeek]))
Small Change in your already existing formula .
Change ALLExcpet into ALLSelected, It should work
If not let me know dude.
- Vicentbi9 years agoFrequent Visitor
Thanks Bro,
I think it just worked
I was missing
var end_Date = MIN('Calendar'[7Day Group]) -1 <--
Thanks a lot.
- Vicentbi9 years agoFrequent Visitor
Got it thanks.
I believe either way I will need to put some sort of index on to of my Name Column. Thanks.
- Baskar9 years agoResident Rockstar
ALLExcpet also work .
Try this Replace Date in Allexcpet with Dimension name.
I hope this will also works for u :-)
- Baskar9 years agoResident Rockstar
Welcome bro.
This is very simple try this one.
Name Test =
var End_Date = MIN('Calendar'[7Day Group]) -7return
CALCULATE(SUM('Fact'[Sales]),FILTER(ALL('Calendar'[7Day Group]),'Calendar'[7Day Group] =End_Date)) - Vicentbi9 years agoFrequent Visitor
Since you are here
Can I ask another question?
is it possible for me to move John to the first position instead of Dimitris?
- Baskar9 years agoResident Rockstar
Yes we can , But for that have create one calculated column like
if ( Name="A",1,2) like until how many names u have . then u have short the name with this value asc or desc.
It will only work if u have constant name , name is changing dynamically it will not helping u .
- Baskar9 years agoResident Rockstar
Welcome my friend