cancel
Showing results 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

Helper I

## Making Matrix Table Aggregates Match

I have a column that shows the last date a contact was interacted with. I'm having that value being aggregated to "Latest" to have it display on the account it belongs to if the group is not expanded. I'm wondering if it's possible to have the other values that display be based on that column:

In this example, Human 3's date has the most recent activity date and displays at the top of the grouping. Is it possible to have it display the corresponding "948000004" and "Site Visit" at the top of the grouping from that row as well?

1 ACCEPTED SOLUTION
Community Support

Hi @morgtd30 ,

You could use ISINSCOPE() function to return specific value at subtotal.

``````measure1 =
var max_date = calculate(max([date]),allexcept('table',[city]))
var max_column1 = calculate(max([column1]),FILTER(allexcept('table',[city]),[date] = max_date))

return
if(isinscope([human]),selectedvalue([column1]),max_column1)``````

The same for column2.

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
3 REPLIES 3
Community Support

Hi @morgtd30 ,

You could use ISINSCOPE() function to return specific value at subtotal.

``````measure1 =
var max_date = calculate(max([date]),allexcept('table',[city]))
var max_column1 = calculate(max([column1]),FILTER(allexcept('table',[city]),[date] = max_date))

return
if(isinscope([human]),selectedvalue([column1]),max_column1)``````

The same for column2.

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Helper I

I fixed the issue. I had the wrong date field in the first var. It works perfectly now!

Changed to:

ActLastActivityType =
var max_date = calculate(max(contacts[wc_lastactivitydate]),allexcept(contacts,contacts[Account Name]))
var max_contactrole = calculate(max(contacts[wc_contactrole]),filter(allexcept(contacts,contacts[Account Name]),contacts[wc_lastactivitydate] = max_date))

return
if(isinscope(contacts[fullname]),selectedvalue(contacts[wc_contactrole]),max_contactrole)
Helper I

Jay thank you for the help.
I'm not getting any values at summarized at the top for that new measure:

It should bring 948000004 to the top.

Here's an example of how my tables are built:

Account Name
City 1
City 2

 Contact Name Account Name Contact Role Contact Type Contact Date Human 1 City 1 948000000 E-Mail 8/8/2022 Human 2 City 1 948000002 E-Mail 8/7/2022 Human 3 City 1 948000004 Site Visit 8/18/2022 Human 4 City 1 948000010 E-Mail

Here's my measure:

ActLastActivityType =
var max_date = calculate(max('Date'[Date]),allexcept(contacts,contacts[Account Name]))
var max_contactrole = calculate(max(contacts[wc_contactrole]),filter(allexcept(contacts,contacts[Account Name]),contacts[wc_lastactivitydate] = max_date))

return
if(isinscope(contacts[fullname]),selectedvalue(contacts[wc_contactrole]),max_contactrole)

Announcements

#### 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.

#### Power BI Monthly Update - February 2024

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

#### Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

#### 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
Top Kudoed Authors