Forum Discussion
Plot Store with Max Sales over Time Period
- 8 years ago
Hi danb,
1. Create the two measures:
the_store_for_max_sales = VAR maxstore = CALCULATE ( MAX ( 'Table'[Store #] ), FILTER ( 'Table', 'Table'[Quantity Sold] = MAX ( 'Table'[Quantity Sold] ) ) ) RETURN CALCULATE ( SUM ( 'Table'[Quantity Sold] ), FILTER ( 'Table', 'Table'[Store #] = maxstore ) )Measure 2 = VAR temp = MAXX ( TOPN ( 1, SUMMARIZE ( ALLSELECTED ( 'Table' ), [Plate], [Store #], "Total", SUM ( [Quantity Sold] ) ), [Total], DESC ), [Store #] ) RETURN IF ( MAX ( 'Table'[Store #] ) = temp, "Y", "N" )2. Drag the measure2 to visual level filter like below.
For more details, you could have a reference of the attachment.
Best Regards,
Cherry
Hi danb,
If I understand your requirement correctly that you want to get the output like below?
If it is, you could refer to the measure below.
the_store_for_max_sales =
CALCULATE (
MAX ( 'Table'[Store #] ),
FILTER ( 'Table', 'Table'[Quantity Sold] = MAX ( 'Table'[Quantity Sold] ) )
)
Then you could create the line chart with the Date and the measure.
Best Regards,
Cherry
Cherry,
I am actually trying to plot the actual sales of whatever store sold the most for that selected plate. For example if I was looking at plate "A" i would want the max chart to plot the daily sales from only Store #5 because it sold the most of all of the stores from that time period.
Sorry for the un-clarity on the original post.
Thank you for you help in this!
Dan
- v-piga-msft8 years agoResident Rockstar
Hi danb,
1. Create the two measures:
the_store_for_max_sales = VAR maxstore = CALCULATE ( MAX ( 'Table'[Store #] ), FILTER ( 'Table', 'Table'[Quantity Sold] = MAX ( 'Table'[Quantity Sold] ) ) ) RETURN CALCULATE ( SUM ( 'Table'[Quantity Sold] ), FILTER ( 'Table', 'Table'[Store #] = maxstore ) )Measure 2 = VAR temp = MAXX ( TOPN ( 1, SUMMARIZE ( ALLSELECTED ( 'Table' ), [Plate], [Store #], "Total", SUM ( [Quantity Sold] ) ), [Total], DESC ), [Store #] ) RETURN IF ( MAX ( 'Table'[Store #] ) = temp, "Y", "N" )2. Drag the measure2 to visual level filter like below.
For more details, you could have a reference of the attachment.
Best Regards,
Cherry
- danb8 years agoResolver I
That works. Thank you so much!
- danb8 years agoResolver I
v-piga-msft - one last question, I am trying to flip it now and identify the Minimum sales store. Was thinking it was as simple as changing the MAXs to MINs and flipping the "DESC" to "ASC" in Measure2 however that is not working. Any recommendations?
Dan