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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

calculation on sum of amount based on difference returned by a measure

hello everyone,

below is my sample data
date                customer       amount
06/12/2019    customer 1     200
22/01/2020    customer 2     250
15/02/2020    customer 3     300
10/03/2020    customer 1     100
29/04/2020    customer 2     220

i want to calculate sum of amount as two different columns based on difference of days between the starting date and ending date in the date slicer.
like this, (assume that the starting and ending dates are min and max date in date column)

date              customer      amount     dateDiff    lesser than 90 days     greater than 90 days
06/12/2019   customer 1   200           145                                               200
22/01/2020   customer 2   250           98                                                 250
15/02/2020   customer 3   300           74              300
10/03/2020   customer 1   100           50              100
29/04/2020   customer 2   220           0                 220

total                                  1070                             620                            450

I achieved this by using measures but i don't want these columns in my table visual, i want only the last two columns.

when i remove other columns, it wil be like this
lesser than 90 days     greater than 90 days
0                                 1070

because, measure retuns a single scalar value, if i remove other columns, the datediff measure will return 145 as difference
between starting and ending date and it will return sum of amount 1070 in column greater than 90 days (because 145 is greater than 90)

i need sum of amount as 620 in column lesser than 90 days and 450 in column greater than 90 days.

 

thanks in advance

2 REPLIES 2
stevedep
Memorable Member
Memorable Member

Can you share the measure definition? You probably need to apply some grouping.

Anonymous
Not applicable

datediff1 = DATEDIFF(MINX('Table (2)','Table (2)'[date]),CALCULATE(MAX('Table (2)'[date]),ALLSELECTED('Table (2)')),DAY)
 
lesser than 90 days = IF([datediff1]<=90,SUM('Table (2)'[amount]),0)
 
greater than 90 days = IF([datediff1]>90,SUM('Table (2)'[amount]),0)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.