Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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 customers split into bins of 30 days.
The difficulty i am facing is that customers dont have the same sales start date. Therefore, i have on customer starting in Jan-2016 and another in March-2016 etc...
Hi @kdaya
You can create a column like below in your Calendar Date Dimension,
360 Bins = VAR _date = 'Calendar'[Date] VAR _today = TODAY() RETURN SWITCH( TRUE, _date >= _today, BLANK(), _date >= _today - 30, 30, _date >= _today - 60, 60, _date >= _today - 90, 90, _date >= _today - 120, 120, _date >= _today - 150, 150, _date >= _today - 180, 180, _date >= _today - 210, 210, _date >= _today - 240, 240, _date >= _today - 270, 270, _date >= _today - 300, 300, _date >= _today - 330, 330, _date >= _today - 360, 360, BLANK() )
Hi @Mariusz,
Thanks for taking the time to reply,
I am still relatively new DAX are you able to explain this please:
Are these new columns that i should create:
VAR _date = 'Calendar'[Date]
VAR _today = TODAY
I appreciate your assistance
Hi @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/
Thanks @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:
Hi @Mariusz
for the first 30 days it should be about 35 sold items but when i use that formula it giving me 9 only.
Hi @kdaya
Can you send the screen shot of a table filtered to 30 days?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
39 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
44 | |
32 | |
30 | |
18 | |
17 |