Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi
I need a week,which will be current week minus 4 week.How to achieve this in UI.
Ex:My Current Week: 2013 W05
Expected Week is:(Current week-4) ie) 2013W01.
How to achieve this.Please help me.
Thanks,
Gowthami
=Max(Week)-4
You can use as
SUM({$<Week = {"$(=Max(Week))"}>}Sales) // Max Week from selected weeks
SUM({$<Week = {"$(=Max(Week)-4)"}>}Sales) // Max Week - 4 from selected weeks
Hi Gowthami
Why can't you just subtract 4*7 from your date?
Lukasz
If you calculate your weeks from a date field I suggest you create it as a dual field:
load
FieldA, FieldB, ...etc ,
MyDate,
dual( Year(MyDate) & 'W' & num(week(MyDate),'00') , weekstart(MyDate)) as MyWeek
From ...etc;
This way the MyWeek values will really still be dates (just shown like 2013W05) and you can subtract a number of days from it:
Expected Week = Current Week - 28
Current Week: max(MyWeek)
Expected Week: max(MyWeek)-28
Perhaps you need to use the weekyear function instead of the year function. Look the weekyear function up in the help file to understand why.
Hi ,
Thanks for your reply.
I have an inputbox, with two fields."Week1" and "Week2"
By default my
"Week 2" should be my Current week.
"Week1" should be current week minus 4
Week field is like this:
2013 W05
2013W04
2013W03
Max(week-4) is not working...
Thanks
Gowthami
Make sure you have your brackets right, Max(Week)-4 =/= Max(Week-4)
Max(Week)-4 will never work this way. Imagine week being 2014W01. What would be Max(Week)-4? Go with Gysbert's suggestion (again )...
Hi,
Thanks for you reply.I don't have any date fileld in my QVD.
Thanks,
Gowthami
then you maybe should create one using the week information. This will be helpful further on as well in your development.
You could ask the person that created that qvd to put a date field in. That week field was created somewhere and most likely from a date field. Or ask him/her to create a dual field like I mentioned. Or ask him/her to at least add a numeric sequential week field so you have a field that can used in calculations to derive an earlier week.