Forum Discussion
product Life cycle in Power BI
- Anonymous9 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
- Anonymous9 years ago
Hi Sagarkansal
Get Set and GO!!!!!!!!!!!!!
The steps file is uploaded as word document at https://1drv.ms/w/s!ApP3mBZyGaHfgRhcMywbLSFj1vXS
and the pbix file https://1drv.ms/u/s!ApP3mBZyGaHfgRoDyFexv0L1JlkY
I will send you a private message for how to give KUDOS. Hey do not forget to give KUDOS to this post.
Cheers
CheenuSing
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
- Sagarkansal9 years ago
Advocate I
Hi Anonymous The year table needs to be dynamic, not static( not only till 2016 but updated automatically accordingly to sales date , which means it will change each year and 2016 was only a reference year. We could have taken 2008 as reference year also and next year 2017 can be reference year
- Sagarkansal9 years ago
Advocate I
Hi Anonymous
there are 2 error shown when I create measure for Launch Products. WHen the syntax is
1. Launched Products = Launch = (CALCULATE(DISTINCTCOUNT(Launch[Product]),FILTER.........
i.e, when there is no closing bracket in Calculate formula after (Launch[Product]), then PBI says the rror is
ERROR: The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
2. When the syntax is as you said as:
Launched Products = Launch = (CALCULATE(DISTINCTCOUNT(Launch[Product])),FILTER
the error shown is as follows:
The syntax for ')' is incorrect. (DAX(Launch = (CALCULATE(DISTINCTCOUNT(Launch[Product])),FILTER(Launch,COUNTROWS(FILTER(VALUES('YEAR'[Year]),Launch[FirstSold]>=('YEAR'[Year])-2&&Launch[FirstSold]<='YEAR'[Year]))>0))))).
- Anonymous9 years agoNot applicable
Hi Sagarkansal
It should be syntax issue .
The original formula I gave was
Launched Products = Calculate(
( distinctcount(Launch[Product])),
FILTER(Launch,
COUNTROWS(FILTER(VALUES(Year[Year]),
Launch[FirstSold] >= ('Year'[Year]) - 2 &&
Launch[FirstSold] <= ('Year'[Year])
))
> 0)
)It is not like Launched Products = Launch = Calculate ( .....
Please check.
As for how it will work with other dimensions, it depnds on the data model. Share the full data model.
Cheers
Cheenusing