Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I've got two tables in my data model:
|
Fiscal Month | Week Count | |
201802 | 4 |
|
201803 | 5 |
|
201804 | 4 |
|
201805 | 4 |
|
201806 | 5 |
|
201807 | 4 |
|
201808 | 4 |
|
201809 | 5 |
|
201810 | 4 |
|
201811 | 4 |
|
201812 | 5 |
|
201901 | 4 |
|
My goal is to find the average weekly sales, based on the time-period selected by my users. I get a number that’s too low because it’s adding up the Week Count for all rows in the data model when I use
Sum(Sales) / Sum(Week Count) = 1.96 units/week
What I need to end up with is the sum of the Week Count for each unique month in the selected time-period, or if no time is selected, then for the entire period in the app (3.92 units/week).
Do you join the two tables together into a single table in your app? Try this may be
Sum(Sales)/ Sum(Aggr(Sum(DISTINCT [Week Count]), [Fiscal Month]))
Do you join the two tables together into a single table in your app? Try this may be
Sum(Sales)/ Sum(Aggr(Sum(DISTINCT [Week Count]), [Fiscal Month]))
Please find the attached qvw.
The same syntax is working for me. Please let me know if you any query.
Thanks
Nilaksh Mahajan