Forum Discussion

Sagarkansal's avatar
Sagarkansal
Icon for Advocate I rankAdvocate I
9 years ago
Solved

product Life cycle in Power BI

Hi all,   I have sales data in of different agricultural products with sales in SALES AMOUNT, which is as following in the picture. Zone State Depot District Crop Product Sales Amount ...
  • Anonymous's avatar
    Anonymous
    9 years ago

    Hi Sagarkansal

     

    Try the following steps, I created for Launch alone.

     

    1. Create a summary table using 

        Launch = SUMMARIZE(Sales,Sales[Product], "FirstSold",Min(Sales[Year]))

        The table name will be called Launch with column names Product and FirstSold

        Link the product from sales fact and product from this table

    2. Create a column called FirstSold in the sales fact table

        as   FirstSold = Related(Launch[FirstSold])

     

    3. Create a year Table which contains the years from 2001 to 2016 and Year as a column name.

        Do no link this to your SalesFact Table.

     

    4. Create a measure called 

        Launched Products = Calculate(
                                                        ( distinctcount(Launch[Product])),
                                                                                   FILTER(Launch,
                                                                               COUNTROWS(FILTER(VALUES(Year[Year]),
                                                                                               Launch[FirstSold] >= ('Year'[Year]) - 2 &&
                                                                                  Launch[FirstSold] <= ('Year'[Year])
                                                                          ))
                                                                        > 0)
                                                                     )

     

     

    5. Create a measure SumSales = sum(Salesfact[Sales])

    6 Create the measure 

                        LaunchedProductSales = Calculate(
                                                                                     ( [SumSales] ),
                                                                                                     FILTER(Sales,
                                                                                             COUNTROWS(FILTER(VALUES(Year[Year]),
                                                                                                                     Sales[Year] >= ('Year'[Year]) - 2 &&
                                                                                                                      Sales[Year] <= ('Year'[Year])
                                                                                                           ))
                                                                                                            > 0)
                                                     )

     

    7. Display the measures using the card visulaisation and it should match your data.

    8.  Create similarly the measures for PeakProducts and Post-Peak Products by altering the year comparison condition.

    9.  Below is a screen shot of the output with your data posted.

     

    If this works for you please accept this as a solution and also give KUDOS.

     

    Cheers

     

    CheenuSing