Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Ethanhunt123
Helper IV
Helper IV

Highest sales recorded against the average

I have a table that has Order, date, Sales

 

Order # Date Sales
Order #1 20 Aug 2019 100
Order #2 20 Aug 2019 200
Order #3 19 Aug 2019 100
Order #4 19 Aug 2019 100
Order #5 19 Aug 2019 200
Order #6 18 Aug 2019 200

 

First I have to find the average sales per day . So for 20 AUG 2019 average would be 150, 19 AUG 2019  = 133 and for 18 AUG average would be 200.

Then I have to find highest sales against the average 

20 AUG 2019 ( 200 - 150) = 50

19 AUG 2019 (200 - 133) = 67

18 AUG 2019 ( 200- 200)  = 0 

 

So the output would be 19 AUG 2019. Many dates can have 67 so I want all those dates as output.

1 ACCEPTED SOLUTION

Hi @Ethanhunt123 ,

 

Create these measures

 

 

 

Average Sale = 
AVERAGE('Table'[Sales])

 

 

 

 

 

MAXX Sale = MAXX(FILTER(ALL('Table'),'Table'[Date] = MAX('Table'[Date])),'Table'[Sales])

 

 

 

 

 

Highest Sale against Average = [MAXX Sale] - [Average Sale]

 

 

 

 

Rank Highest Sales = RANKX(ALL('Table'[Date]), [Highest Sale against Average])

 

 

 

 

1.jpg

 

1.jpg

 

Create a Visual Filter where Rank =1

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

View solution in original post

4 REPLIES 4
ryan_mayu
Super User
Super User

@Ethanhunt123 

you can try to create a new table to return the date value.

Table 2 = 
VAR tbl=SUMMARIZE('Table','Table'[Date],"diff",max('Table'[Sales])-AVERAGE('Table'[Sales]))
VAR tbl2=ADDCOLUMNS(tbl,"rank",RANKX(tbl,[diff],,DESC))
return SELECTCOLUMNS(FILTER(tbl2,[rank]=1),"date",'Table'[Date])

1.PNG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




amitchandak
Super User
Super User

@Ethanhunt123 , Plot this measure with date

countx(filter(summarize(Table,table[Date], "_1", Rankx(all(Table), calculate( max(Table[Sales]) - avergage(Table[Sales])),,desn,skip)),[_1]=1),[Date])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hi @Ethanhunt123 ,

 

Create these measures

 

 

 

Average Sale = 
AVERAGE('Table'[Sales])

 

 

 

 

 

MAXX Sale = MAXX(FILTER(ALL('Table'),'Table'[Date] = MAX('Table'[Date])),'Table'[Sales])

 

 

 

 

 

Highest Sale against Average = [MAXX Sale] - [Average Sale]

 

 

 

 

Rank Highest Sales = RANKX(ALL('Table'[Date]), [Highest Sale against Average])

 

 

 

 

1.jpg

 

1.jpg

 

Create a Visual Filter where Rank =1

 

 

Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

 

This is giving me 1 for all the dates.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.