Forum Discussion
Anonymous
6 years agoNot applicable
Sales Analysis using Power BI
Use case- We have many automotive parts that are being sold by us. We have grouped them into 2 groups. Top 20 and then rest of the parts The requirement is that I want to see when we have a good or...
v-juanli-msft
Community Support
6 years agoHi Anonymous
Copy the date table to create another date table, the "date2" table has no relationship with others
date2 = 'Date'
Create two what-if parameter
"Last N month" and "TopN"
Once parameters created, it would create one calculated column and one measure for each parameter
column-Last N month, measure-Last N month value
"TopN" and "TopN value"
Create measures
Measure = CALCULATE(SUM('Table'[sales]),FILTER('Date','Date'[year-month]=SELECTEDVALUE(date2[year-month])))
top n slaes = IF(RANKX(ALLSELECTED('Table'[part]),[Measure],,DESC,Dense)<=[TopN Value],[Measure])
average per part =
IF (
[top n slaes]
<> BLANK (),
CALCULATE (
SUM ( 'Table'[sales] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[part]
= MAX ( 'Table'[part] )
&& DATEDIFF (
'Table'[date],
EOMONTH (
TODAY (),
-1
),
MONTH
) <= [Last N month value] - 1
&& 'Table'[date]
<= EOMONTH (
TODAY (),
-1
)
)
) / [Last N month value]
)
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.