cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mlmagl14
Helper I
Helper I

How to get total sales in a date range

Hi,

 

I have a sales report with sales numbers that shows all the sales from multiple vendors for 2022. I would like to create a report that shows me the percentage of total sales from only 2 specific vendors from a date range. I created a matrix table where I filtered my two vendors I want to look at. I have the 2022 total sales of those two vendors in one column and I created another measure to show total sales of All the vendors, so that I can divide the two to get me the % of total sales for those two vendors. The matrix I created shows me % of sales for all of 2022. Now I would like to do this same thing, but from a specific date range like the week of April 18-24. I would need the total sales of that week for those two vendors and the total sales of All the vendors for that week so i can find the percentage of total sales. Is that possible? Is there a dax for this?

 

Sales.jpg

 

Data set ex.

data set.jpg

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @mlmagl14 ,

Your measures will be something like below but depends on how your dataset is modeled.

 

Sales From To =
CALCULATE (
    SUM ( Table[Value] ),
    DATESBETWEEN ( 'Table'[Date], DATE ( 2022, 4, 18 ), DATE ( 2022, 4, 22 ) )
)
Vendor Sales From To =
CALCULATE (
    [Sales From To],
    FILTER ( Table, Table[Vendor] = "Vendor 1" || Table[Vendor] = "Vendor 2" )
)
Percentage =
DIVIDE ( [Vendor Sales From To], [Sales From To] )

 


If you want your questions answered quickly and with better solutions, please read this post:
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523#M6071...








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

Proud to be a Super User!




"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
www.linkedin.com/in/danebelarminocpa

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @mlmagl14 ,

Your measures will be something like below but depends on how your dataset is modeled.

 

Sales From To =
CALCULATE (
    SUM ( Table[Value] ),
    DATESBETWEEN ( 'Table'[Date], DATE ( 2022, 4, 18 ), DATE ( 2022, 4, 22 ) )
)
Vendor Sales From To =
CALCULATE (
    [Sales From To],
    FILTER ( Table, Table[Vendor] = "Vendor 1" || Table[Vendor] = "Vendor 2" )
)
Percentage =
DIVIDE ( [Vendor Sales From To], [Sales From To] )

 


If you want your questions answered quickly and with better solutions, please read this post:
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523#M6071...








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

Proud to be a Super User!




"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
www.linkedin.com/in/danebelarminocpa
SanketBhagwat
Super User
Super User

Hi @mlmagl14 .

If you want your data to filter by week range then you can create week number using =WEEKNUM('Date column') and then have it inside a slicer.

Thanks,
Sanket


If this post helps, then mark it as 'Accept as Answer' and give it a thumbs up.

amitchandak
Super User
Super User

@mlmagl14 , create a range based slicer on date and you can get it



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s || 50+Power Query List Functions : Learn Power Query List
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Show episode 9

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 25

Ted's Dev Camp - August 25, 2022

Watch Session 25 of Ted's Dev Camp.

Top Solution Authors