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
AW1976NOVA
Post Patron
Post Patron

Modify Existing Created Measure to include Created Variable

Hi,

 

I have a created measure that is working correctly.  However, I need to create an additional Created Measure that calculates something slightly different.  I want to take the existing Created Measure and modify it to accomplish this new requirement.  Here is the current created measure as a basis point:

 

Employer Group ER Cost = sumx(values('Data Files'[MBR_ID]),calculate(max('Data Files'[ER_Cost])))
 
This measure calculates the Sum of [ER_Cost] for each [MBR_ID].
 
I now need to create a new measure that is slightly different.  I need to incorporate a FILTER where the [Source Date] field is the latest date.
 
I think the best way to do this would be to first create the variable I need to bring in as the FILTER.  Here is that portion:
 
Latest Date = VAR __MaxDate = MAX([Source Date])
 
I need to bring the __MaxDate variable in as a FILTER for my original Created Measure:
 
Employer Group ER Cost = sumx(values('Data Files'[MBR_ID]),calculate(max('Data Files'[ER_Cost])))
 
...but there is simply too many things going on with this measure for me to understand how to properly bring __MaxDate in as a FILTER.
 
 
Can you please help,
Andrew
 
Thank you!!!!
1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @AW1976NOVA,

I think your raw formula not suitable to nested with other functions. (normal we will use the simple aggregate formulas raw formula to nested and used on other formulas)
You can take a look at the following blog to know more about how to nested multiple forums:

Optimizing DAX expressions involving multiple measures 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

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.