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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Satan
Regular Visitor

Find out total sales for last week per specific day

Hi all, so i'm completely new to DAX/PowerBI and was looking for some guidence. I'm looking to get the sum of all sales throughout my company for last week(excluding sunday) and have the option to select specific days. 

 

 

Any ideas?

1 ACCEPTED SOLUTION
v-haibl-msft
Employee
Employee

@Satan

 

In this scenario, you can create a calculate table to get the expected result. Assume you have a dataset as below.

Find out total sales for last week per specific day_1.jpg

  1. Use following formula to create a table which only includes data of last week.
    Table2 = 
    CALCULATETABLE (
        Table1,
        WEEKNUM ( Table1[Date] )
            = WEEKNUM ( TODAY () ) - 1,
        WEEKDAY ( Table1[Date] ) <> 1
    )
  2. Create a column to show the weekday.
    WeekDay = 
    FORMAT ( Table2[Date], "dddd" )
  3. Drag a Slicer (select Table2[WeekDay] for Field) and a Card chart into your canvas.
    Find out total sales for last week per specific day_2.jpg

View solution in original post

4 REPLIES 4
v-haibl-msft
Employee
Employee

@Satan

 

In this scenario, you can create a calculate table to get the expected result. Assume you have a dataset as below.

Find out total sales for last week per specific day_1.jpg

  1. Use following formula to create a table which only includes data of last week.
    Table2 = 
    CALCULATETABLE (
        Table1,
        WEEKNUM ( Table1[Date] )
            = WEEKNUM ( TODAY () ) - 1,
        WEEKDAY ( Table1[Date] ) <> 1
    )
  2. Create a column to show the weekday.
    WeekDay = 
    FORMAT ( Table2[Date], "dddd" )
  3. Drag a Slicer (select Table2[WeekDay] for Field) and a Card chart into your canvas.
    Find out total sales for last week per specific day_2.jpg

That done the trick, thank you. Regarding the slicer, the days are in a mixed order i.e. Monday, Thursday, Tuesday, Friday etc. Is there anyway i can change this to the correct day format? Monday, Tuesday, Wednesday etc. 

 

Also there was one more thing i was hoping for some advice on. Is there a way i can list the top selling products by day/week/year?.

 

Thanks again, Kris and Herbert 🙂

@Satan

 

Please select the column Table2[WeekDay] and click “Sort By Column – Date” as below.

Find out total sales for last week per specific day_1.jpg

 

For the top selling products, I think you can try to use the RANKX function. In below screenshot, I rank the total sales in all departments for each day last week.

Find out total sales for last week per specific day_2.jpg

 

Best Regards,
Herbert

a_mixed_life
Resolver I
Resolver I

I would recommend to have a Date table or Date Filter table. You can achieve that by getting a DateStream from Azure Marketplace. See my post here from another post. Hope that helps!

 

http://community.powerbi.com/t5/Desktop/How-to-Sort-Months-Chronogically/m-p/50469#M20204

 

DayWeekSun.PNGDayWeekMon.PNG

Kris

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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