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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
setis
Post Partisan
Post Partisan

Date of last email

Hi all,

 

I have a table of [Activities] with the columns "Case ID", "Activity Type" and "Created On", The "Activity types" can be "email", "phone call", etc... 

 

I need to pull a table of cases with the Case ID and the date of the last email 

 

I've created a measure:  LatestActivity = MAX(Activities[createdon])

 

It is working for me as a calculated column: 

LastEmail = CALCULATE(MAX(Activities[createdon]);Activities[ActivityType]="Email")

 

But not as a measure: 

Latest email = CALCULATE ([LatestActivity]; FILTER(Activities;Activities[ActivityType]="Email"))
 
The result that I'm obtaining is the last email of the whole activity table, not row by row. 
 
Could somebody help, please?
1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi@setis

Create a measure

Measure = CALCULATE(MAX([Created On]),FILTER(ALLEXCEPT(Sheet10,Sheet10[Case ID]),[Activity Type]="email"))

9.png

 

 

Best Regards

Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi@setis

Create a measure

Measure = CALCULATE(MAX([Created On]),FILTER(ALLEXCEPT(Sheet10,Sheet10[Case ID]),[Activity Type]="email"))

9.png

 

 

Best Regards

Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Stachu
Community Champion
Community Champion

measure will always give you single value for a given filter context, therefore if you have a visual that gived single value it will do exactly that
if you create a table in which emails are in rows then each row will have a different filter context, and the measure should return different values for them



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

AlB
Super User
Super User

Hi @setis

I'm a bit confused because from what you describe I believe your measure should work but your column shouldn't. Exactly the opposite of what you claim Smiley Happy

 

The calc column would need to get rid of the context transition effect to work properly. Otherwise it will calculate the max only on the current row when the activity is email.

The measure, however, looks fine to me. How/where exactly are you using it? If you place Activities[Case ID] in the rows of a matrix visual for instance and the measure in values, I see no reason for it not to work (with the info you provide).

 

Your description is quite good but remember it's always best to show a sample of your tables/data in text format. It's very helpful for people trying to answer. Or sharing the pbix if possible     

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors