Forum Discussion

ashwinkolte's avatar
ashwinkolte
Helper III
3 years ago

Need help to create rows in table

I have a input table as below

 

ProductcategorySalesDate
P1C110031-Jan-23
P1 C220030-Apr-23
P2C1100

30-Jun-22

 

I want an output table as given below. i.e for whichever months OF THE YEAR there are no sales it should insert row with 0 sales for EACH product & category combination .

 

ProductcategorySalesDate
P1C110031-Jan-23
P1C1028-Feb-23
P1C1031-Mar-23
P1C1030-Apr-23
P1C1031-May-23
P1C1030-Jun-23
P1C1031-Jul-23
P1C1031-Aug-23
P1C1030-Sep-23
P1C1031-Oct-23
P1C1030-Nov-23
P1C1031-Dec-23
P1C2031-Jan-23
P1C2028-Feb-23
P1C2031-Mar-23
P1C220030-Apr-23
P1C2031-May-23
P1C2030-Jun-23
P1C2031-Jul-23
P1C2031-Aug-23
P1C2030-Sep-23
P1C2031-Oct-23
P1C2030-Nov-23
P1C2031-Dec-23
P2C1031-Jan-22
P2C1028-Feb-22
P2C1031-Mar-22
P2C1030-Apr-22
P2C1031-May-22
P2C110030-Jun-22
P2C1031-Jul-22
P2C1031-Aug-22
P2C1030-Sep-22
P2C1031-Oct-22
P2C1030-Nov-22
P2C1031-Dec-22

 

Appreciate if you can help with this 

1 Reply

  • Hey ashwinkolte ,

     

    it's not clear, why the resulting table does not start on June 2022 for all products and does not end on December 2023 for all products/categories.

     

    Next to that, it's not a good idea to create a fact table containing rows with a "zero" measurement. Instead I recommend creating a data model adhering to the star stema paradigm. Using a dedicated calendar table allows you to activate the option "Show items with no data" on the data visualization:

     

    Regards,

    Tom