Sum value on a specific time window deduplicating

Hi all,

I'm trying to solve something a bit weird. It was working correctly, and without doing anything, my card is not working anymore. When I'm editing it, it's completely broken


Type of data

date|service|daily_service_sales|placement|daily_placement_sales

2021/04/01|Service_A|80|Placement_AA|10

2021/04/01|Service_A|80|Placement_AB|12

2021/04/01|Service_B|40|Placement_BA|13

2021/04/01|Service_A|90|Placement_AA|20

2021/04/01|Service_A|90|Placement_AB|10

2021/04/01|Service_B|30|Placement_BA|8

2021/04/01|Service_B|30|Placement_BA|6


What I'm trying to achieve is to build a is a Line + Grouped bar chart per week with 3 types of data


You can notice that the daily_service_sales values is repeated each time a placement is performing


3 beast mode are used into the following card

weekly_service_sales : sum of unique daily_service_sales per week

(SUM(SUM((daily_service_sales)) OVER(partition by YEAR(`date`),WEEK(`date`), `service`))


weekly_placement_sales: sum of daily_placement_sales per week

(SUM(SUM((daily_placement_sales)) OVER(partition by YEAR(`date`),WEEK(`date`), `service`))

weekly_ratio : weekly_placement_sales / weekly_placement_sales


The current card


When I'm trying to edit it or trying to create a new one.


Am I doing something wrong?

Help me please,

Julien

Comments

  • Can you share the chart properties? Are you sorting by anything?


    “There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
  • @user047019

    How are you grouping your dates in analyzer? Are you showing it by day or none or by week?

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • Thanks for trying to help me

    I 'm sortering my graph by date. And I don't have so much specific properties

    I'm trying to show this graph per week. As you can see, on the second chart, there is a multiplication of number of week.

    When I'm trying to share calculation through Dataset, the duplication on the graph is happening.

  • And now, when I'm trying to build a new dashboard from a new data set with new beast mode, duplciation of week is happening all the time.

  • Here is the result


    And when I'm filtering on a specific service:


  • You need to remove service from the partition by clause.

    That is why you are getting an extra row of data for each type of service that was present in that week


    “There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
  • What I want to get is the chart per week. Fully aggregated. and I have another card to be able to select Service(s) and/or placement(s)

    Here is the graph with those beastmode

    weekly_placement_sales: (SUM(SUM(`daily_placement_sales`)) OVER(partition by YEAR(`date`),WEEK(`date`)))

    weekly_service_sales : (SUM(SUM(`daily_service_sales`)) OVER(partition by YEAR(`date`),WEEK(`date`)))

    Ratio:

    (SUM(SUM(`daily_placement_sales`)) OVER(partition by YEAR(`date`),WEEK(`date`)))

    /

    (SUM(SUM(`daily_service_sales`)) OVER(partition by YEAR(`date`),WEEK(`date`)))


  • Can you change the x-axis to be MIN of the date field?


    “There is a superhero in all of us, we just need the courage to put on the cape.” -Superman
  • Impossible to achieve that.. I really don't understand why it's not working

  • I believe Domo broke this functionality back in Feb of this year and never fixed it. you can't do math on the PARTITION BY clause on Dates and then aggregate to the week using the Date filter grouping functionality.

    Instead, calculate YearWeek as a materialized column on your dataset and change your Partition By Clause to use the new YearWeek column.

    Also be careful. YearWeek the way you calculated it will break near the start of January and end of December each year.

    Jae Wilson
    Check out my 🎥 Domo Training YouTube Channel 👨‍💻

    **Say "Thanks" by clicking the ❤️ in the post that helped you.
    **Please mark the post that solves your problem by clicking on "Accept as Solution"
  • Depending on how you count your weeks you could also calculate the first day of the week or the last day of the week so that you have a continuous week and not have issues with the start / end of the year. This is assuming you'd count a week that started on 12/30/2020 as the last week in 2020 and would include 12/30/2020 - 1/5/2021.


    Here's a post I did about calculating the first and last days of the week with a beast mode (you could do this in a dataset view) but can easily be converted to an ETL 2.0 formula tile:

    https://dojo.domo.com/discussion/52687/domo-ideas-exchange-beast-modes-first-last-days-of-the-month-week

    **Was this post helpful? Click Agree or Like below**
    **Did this solve your problem? Accept it as a solution!**
  • user047019
    user047019 Member
    edited April 2021

    Thanks both, let met investigate and come back to you