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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sydv
New Member

How to calculate Sum of Amount , for specific list of ID's falling in one date range?

I need to create a visual with calculate the sum of AmountCY and AmountLY, withrevenue year and month. The data has Amount, IDs, RDate, IntDate. I have to calculate sum of Amount for previous year(based on RDate column) for only those IDs which were present in selected date range and on a particular IntDate. I have calculated two measures AmountCY and AmountLY.

where Rdate range =01/01/2020 to 10/30/2020

I need AmountLY values only for Id =110 . As the Rdate for Previous year will be =01/01/2019 to 10/30/2019. and only this id was present in selected Rdate range(current year range)

AmountLYIDAmountLYRDateIDate
10000100 5/27/20207/26/2020
 102126.39/6/20197/26/2020
 11030003/30/20197/26/2020
3000110 4/18/20207/26/2020
 1227.037/12/20197/26/2020
 12215007/13/20197/26/2020
 1321052.55/20/20197/26/2020
2 REPLIES 2
amitchandak
Super User
Super User

@sydv , You can join RDate with date table and use that as slicer

 

Sum(Table[AmountCY]) is for that range

Year behind = CALCULATE(Sum(Table[AmountCY]),dateadd('Date'[Date],-1,Year))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi,

 

Thanks for points,

But this would again give the same values as I have in AmountLY measure.

while I need values against only those ID's in Year Behind measure which are present in current year. i.e. AmountLY for ID -110 only. 

 

Regards

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.