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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
avtandylru
Frequent Visitor

Calculate SUM of dax measures

Hu guys. I need to calculate sum of previous calculated measure.

Client  DaysInPeriod(measure)
 1        10
 2        25
 3        30
Total     30

Need

Client   DaysInPerdiod    Total
 1           10             65
 2           25             65
 3           30             65
Total        30             65

 

I' ve tried something like 

Measure 2 = var DaysInPeriod = CALCULATE(DATEDIFF(CALCULATE(MIN(OvPortfolio[daydate_fuib]);ALLSELECTED('Calendar'[daydate_fuib]));CALCULATE(MAX(OvPortfolio[daydate_fuib]);ALLSELECTED('Calendar'[daydate_fuib]));DAY);ALLEXCEPT(OvPortfolio;OvPortfolio[clientid]))
return CALCULATE([DaysInPeriod];ALL(OvPortfolio))
 
But i get
Client   DaysInPerdiod    Total
 1           10             30
 2           25             30
 3           30             30
Total        30             30
 
 
 
1 ACCEPTED SOLUTION
avtandylru
Frequent Visitor

CALCULATE(SUMX(DISTINCT(OvPortfolio[clientid]);CALCULATE(DATEDIFF(CALCULATE(MIN(OvPortfolio[daydate_fuib]);ALLSELECTED('Calendar'[daydate_fuib]));CALCULATE(MAX(OvPortfolio[daydate_fuib]);ALLSELECTED('Calendar'[daydate_fuib]));DAY);ALLEXCEPT(OvPortfolio;OvPortfolio[clientid])));ALLSELECTED(OvPortfolio))

View solution in original post

1 REPLY 1
avtandylru
Frequent Visitor

CALCULATE(SUMX(DISTINCT(OvPortfolio[clientid]);CALCULATE(DATEDIFF(CALCULATE(MIN(OvPortfolio[daydate_fuib]);ALLSELECTED('Calendar'[daydate_fuib]));CALCULATE(MAX(OvPortfolio[daydate_fuib]);ALLSELECTED('Calendar'[daydate_fuib]));DAY);ALLEXCEPT(OvPortfolio;OvPortfolio[clientid])));ALLSELECTED(OvPortfolio))

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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