Forum Discussion
kdaya
Helper I
7 years agoTrend Analysis based on relative starting date
Hi Community Please can i get some assistance with below issue i am trying to resolve? I need to build a trend graph which shows for example the first 360 days of sales activity of a customer...
Mariusz
Community Champion
7 years agoHi kdaya
The whole expression is one column, VAR is a variable, you use variables if you need to reuse something like I did with date column and TODAY() function.
here is an article that can probably explain this in more detail.
https://www.sqlbi.com/articles/variables-in-dax/
kdaya
Helper I
7 years agoThanks Mariusz
I tried that and realised they were variables (thanks for the link). However i seem to be getting incorrect results, my formula is below:
DAY360 = VAR CDate = request[Created Time].[Date] VAR _Today = TODAY()
RETURN
SWITCH
(TRUE,
CDate >= _Today, BLANK (),
CDate >= _Today - 30, 30,
CDate >= _Today - 60, 60,
CDate >= _Today - 90, 90,
CDate >= _Today - 120, 120,
CDate >= _Today - 150, 150,
CDate >= _Today - 180, 180,
CDate >= _Today - 210, 210,
CDate >= _Today - 240, 240,
CDate >= _Today - 270, 270,
CDate >= _Today - 300, 300,
CDate >= _Today - 330, 330,
CDate >= _Today - 360, 360,
CDate >= _Today - 390, 390,
CDate >= _Today - 420, 420,
CDate >= _Today - 450, 450,
BLANK()
)
Formula showing incorrect numbers
Correct numbers for the month i.e. March-17 = 1 April=34 etc
Any clues on why this could be happening
Thanks in advance