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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Ritaf
Responsive Resident
Responsive Resident

Sum with Filters of dates in same table

Hi all, 

I have a table with data on purchases and their entries in my model (see picture.)
I need to calculate the sum of purchase values for all suppliers that have at least one entry on the year of purchase without filtering only unit entries. I need some help creating the measure for it.
The sample Pbix is on the link:
https://drive.google.com/file/d/1UtRE4MuIrKg0iwp1GlsxPp8UYvvIHJkL/view?usp=sharing

Thanks a lot, RitatestC.JPG

 



1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1653295899994.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

14 REPLIES 14
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1653238236257.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Ritaf
Responsive Resident
Responsive Resident

Hi,
Thank you for your response, but this is not what I need.
your dax is calculating all purchases, I need all purchases of suppliers that have at least 1 entry on the filtered period...
Mindik doesn't have entries in 2021 so I need to get 0 for hima.JPG

 

CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1653295899994.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Ritaf
Responsive Resident
Responsive Resident

Wow!! Thank you, exactly what I need 🙂

hnguy71
Super User
Super User

Hi @Ritaf ,

 

Do you have sample output? If I understood correctly, you want to only show amounts where the entry date and purchase dates are within the same year?

 

If so, this is likely what you're looking for:

Sum of Purchases Same Year = CALCULATE(SUM(purchaseItems[purchaseValue]), YEAR(purchaseItems[entryDate]) = YEAR(purchaseItems[puchaseCretedon]))

 

hnguy71_0-1653228549255.png

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Ritaf
Responsive Resident
Responsive Resident

HI,
Thank you for your response.
This formula is not exactly what I need because it will summarize only rows with entries.
I need to take all suppliers who have at least one entry and summarize all their purchases including the items that didn't incomed.
In the picture below the result, I want for Magnafy is 230.jj.JPG

 

@Ritaf ,

 

Can you tell me the logic on how you're omitting item ID 555 and 666? Or how you're including 222? Why is it only 2021 and not 2022? 

 

hnguy71_0-1653232469870.png

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Ritaf
Responsive Resident
Responsive Resident

555 was with a mistake which Ihhh.JPG

 

corrected.
666 is correct...entry date is 08/12/2022 (8 December)

Hi @Ritaf,

Changing the date for purchase id 555 by 8 days doesn't really help me understand the exclusion logic.  Days for 555 and 666 seems to be future dates. Do you want to omit future purchase dates?



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Ritaf
Responsive Resident
Responsive Resident

No, I want to calculate for Supplier all values by year, but I want to do it for only those who have at least one entry in the year of calculating...

Hi @Ritaf ,

 

Is this safe to assume so?

 

hnguy71_1-1653237310219.png

 



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Ritaf
Responsive Resident
Responsive Resident

NO , i don't need notes
i need a calculation...

hehehe,

 

those notes are for me to understand where to add the numbers to. Can you confirm my understanding?



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Ritaf
Responsive Resident
Responsive Resident

OK, and yes that's the logic

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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