cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

How to get Yesterday TOp 5 Sales by Category ?

I have a Date slicer with certain date range, balance and Product code.

So i have tried everything that i found in google but all failed.

I am just trying to get Top5 Product COde  (Yesterday Only) Yesterday only.

Yesterday= max (date)-1  (depending on date range slected date slicer)

Any one? Pelase help me. 🙂

Thanks in Advance
PBIX File 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: How to get Yesterday TOp 5 Sales by Category ?

Hi @arungurung ,

 

We can create a date table and a measure to meet your requirement.

 

1. Create a date table and there is no relationship between two tables.

 

Date = CALENDARAUTO()

 

how1.jpg

 

2. Then we can create a measure, and use the measure to create a table visual.

 

Measure = 
var _today = MAX('Date'[Date])
var _yesterday = _today - 1
var _result = CALCULATE(SUM(Sheet1[BalanceFCY]),FILTER(Sheet1,Sheet1[DataDate]=_yesterday))
return
_result

 

3. We need to configure the TOPN in filters on this visual, put the measure in ProductCode field.

 

how2.jpg

 

4. At last we create a date slicer and the result like this,

 

how3.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

BTW, pbix as attached.

View solution in original post

2 REPLIES 2
Highlighted
Super User IX
Super User IX

Re: How to get Yesterday TOp 5 Sales by Category ?

@arungurung , Try creating Rank on measure like this and check

 

Last Day = CALCULATE(sum('order'[Qty]), previousday('Date'[Date]))

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/3...



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Highlighted
Community Support
Community Support

Re: How to get Yesterday TOp 5 Sales by Category ?

Hi @arungurung ,

 

We can create a date table and a measure to meet your requirement.

 

1. Create a date table and there is no relationship between two tables.

 

Date = CALENDARAUTO()

 

how1.jpg

 

2. Then we can create a measure, and use the measure to create a table visual.

 

Measure = 
var _today = MAX('Date'[Date])
var _yesterday = _today - 1
var _result = CALCULATE(SUM(Sheet1[BalanceFCY]),FILTER(Sheet1,Sheet1[DataDate]=_yesterday))
return
_result

 

3. We need to configure the TOPN in filters on this visual, put the measure in ProductCode field.

 

how2.jpg

 

4. At last we create a date slicer and the result like this,

 

how3.jpg

 

If it doesn’t meet your requirement, could you please show the exact expected result based on the table that you have shared?

 

Best regards,

 

Community Support Team _ zhenbw

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

BTW, pbix as attached.

View solution in original post

Helpful resources

Announcements

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

Top Kudoed Authors