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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
skanord
Advocate II
Advocate II

SUM of complicated DAX measure

Hello, 

 

I have created the three folowing DAX measures to use in the Matrix pictured below. 

Month_Val_EOL = 
// Calculates the sum of the Monthly value for all rows where Exp_date_YN is "yes" 
// and removes any filter on 'Fiscal.Date'
CALCULATE (
    SUM ( 'Service Contr Lines (2)'[Monthly value] ),
    'Service Contr Lines (2)'[Exp_date_YN] = "yes",
    ALL ( 'Fiscal.Date' )
)
exp_date_EOL = 
// Returns "True" if the maximum expiration date in 'Service Contr Lines (2)' is less than the fiscal date

VAR all_exp_ =
    CALCULATE (
        MAX ( 'Service Contr Lines (2)'[Contract_Expiration_Date] ),
        ALL ( 'Fiscal.Date' )
    )
VAR exp_date_ =
    all_exp_ < MAX ( 'Fiscal.Date'[Date] )
    
RETURN
    IF ( exp_date_, "True", "" )
EOL_Churn = 
// Calculates the final result based on whether the expiration date is less than the fiscal date or not
VAR Month_value =
    SUM ( 'Service Contr Lines (2)'[Monthly value] )
    
RETURN
    IF ( [exp_date_EOL] = "True", [Month_Val_EOL], Month_value )

 

The matrix: 

skanord_0-1678110621177.png

The Yellow numbers represent the values generated by the Month_Val_EOL meassure. 

My problem: 

I would like to calculate the sum of all the yellow numbers, and be able to filter them by fiscal year, and other elements that are in the matrix (such as contract no, buyer, etc.). 

I am expecting to show the sum in a seperate table, but if it is possible i would prefer to sum it in the Matrix pictured above, but this might be too complicated. 

Any help is appriciated!

 

3 REPLIES 3
MFelix
Super User
Super User

Hi @skanord ,

 

Depending on the model you need to use a SUMX function can be something similar to:

 

TotalMonthVAl_EOL =

SUMX(VALUES(Table:_Contract_Expiration_Date), [Month_Val_EOL])

 

Again this depends on your model and the way you are doing your calculations.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



I have made the folowing DAX measure: 

TotalMonthVAl_EOL = 

SUMX(VALUES('Service Contr Lines (2)'), [Month_Val_EOL])

 

But it only shows the sum for one month, and not for all the months highlighted in yellow, as seen in the picture below.

In the picture i have selected the line where the monthly value is 4220, and the card on the right shows the TotalMonthVAl_EOL calculation. Here the desired result would have been 29540, instead of 4220. 

skanord_0-1678709042198.png

How can i change the measure to achieve this?

 

Hi @skanord ,

 

Can you please share a mockup data or sample of your PBIX file. You can use a onedrive, google drive, we transfer or similar link to upload your files.

If the information is sensitive please share it trough private message.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.