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
abhishek_tlc
Regular Visitor

Sales against same category but for different time frames

Hi

I have a sales table A wherein I have daily sales for all the brands.

I have another table B wherein I have Brands listed with a different launch and end dates.

abhishek_tlc_0-1594046383499.png

 

I want sales info in table B, but within that specified data range (i.e. sales between launch & end date only) in different rows.

How can I do that in PowerBI?

 

Thanks

Abhishek

1 ACCEPTED SOLUTION
v-deddai1-msft
Community Support
Community Support

Hi @abhishek_tlc ,

 

Please refer to the calculated column: 

 

 

Column = CALCULATE(SUM(TableA[Sales]),FILTER(TableA,TableA[Date]<=EARLIER(TableB[End Date]) && TableA[Date] >= EARLIER(TableB[Launch Date]) && TableA[Brand ID] = EARLIER(TableB[Brand ID])))

 

 

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

 

Best Regards,

Dedmon Dai

View solution in original post

2 REPLIES 2
v-deddai1-msft
Community Support
Community Support

Hi @abhishek_tlc ,

 

Please refer to the calculated column: 

 

 

Column = CALCULATE(SUM(TableA[Sales]),FILTER(TableA,TableA[Date]<=EARLIER(TableB[End Date]) && TableA[Date] >= EARLIER(TableB[Launch Date]) && TableA[Brand ID] = EARLIER(TableB[Brand ID])))

 

 

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

 

Best Regards,

Dedmon Dai

amitchandak
Super User
Super User

@abhishek_tlc , new column in Table b

sumx(Filter(TableA, TableA[Brand ID] =TableA[Brand ID] && TableA[Date] >=TableA[Lunch Date] && TableA[Date] <=TableA[end Date]),TableA[Sales] ) 

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.