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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
AdmanPowerBI
Frequent Visitor

Multiple Filters with SUMX

Hi There,

 

I hope that I have described this correctly but here it goes:

 

I'm working on a solution to find previous year-to-date and I found that Kasper On BI had a great solution. I have a new dataset which includes much higher details on my sales data, down to individual lines and then BOM levels of our product build up. Here is an example of the dataset:

OrderNumberLineItemProductBOM_IDLineItemPriceInvoiceDate
40000176000001001952.0303/18/2016
40000171000001011952.0303/18/2016
40000171001121952.0303/18/2016
40000171100031952.0303/18/2016
40000171401541952.0303/18/2016
4000019600000100863.5303/18/2016
4000019100000101863.5303/18/2016
4000019100112863.5303/18/2016
4000019110003863.5303/18/2016

It is a bit cumbersome but I am able to find my order value with the following measure:

$OrderValue = SUMX(FILTER(OrderTable,BOM_ID=0),LineItemPrice))

 

When I use the attempt to use Kasper's Sales sameperiod measure:

Sales sameperiod =
VAR startyear =
    STARTOFYEAR ( ‘Calendar'[Date] ) – 365
VAR enddate =
    LASTDATE ( Sales[Date] ) – 365
RETURN
    CALCULATE (
        SUM ( Sales[sales] ),
        DATESBETWEEN ( ‘Calendar'[Date], startyearenddate )
    )

 

I am having trouble returning a value over that time period that takes into account both the date filter and to just select BOM_ID=0.

 

Thanks for any help you can give!

1 ACCEPTED SOLUTION
calerof
Impactful Individual
Impactful Individual

Hi @AdmanPowerBI ,

 

Check this pbix file.

 

Regards,

 

Fernando

 

View solution in original post

6 REPLIES 6
calerof
Impactful Individual
Impactful Individual

Hi @AdmanPowerBI ,

 

Check this pbix file.

 

Regards,

 

Fernando

 

Hi @calerof ,

 

Thank you very much! That worked 🙂

I can honestly say I'm not quite sure why and if you have time, I would love to know. Again thanks so much.

 

Adam

Hi @AdmanPowerBI ,

 

First and foremost, if you review the pbix file, a Calendar table was added to the model and marked as Date Table.

 

Then, in the Order Value measure I used an explicit measure to sum the line item price, instead of using the implicit measure LineItemPrice.

 

Lastly, in the Sales Same Period measure I used the Order Value measure in the RETURN calculation, instead of SUM ( Sales[sales] ).

 

That was pretty much it.

 

Best regards,

 

Fernando

 

Again thank you!

 

Greg_Deckler
Community Champion
Community Champion

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thanks Greg!

I have been working on a solution with CALCULATETABLE although I haven't quite solved it yet. I will keep plugging away and let you know how this goes.

Adam

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors