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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors