cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ffitzpatrick47 Helper II
Helper II

Grand totals and the context of numbers

I have this equation:

calculate([sCnt],filter(all(Query1[dq]),Query1[dq]=max(Query1[iq])))

 

That I'm using in a pivot table where the filter context of Query1[iq] doesn't exist because it does not appear in the pivot table, instead, the filter context contains fields that are irrelevant to this equation.  I'm just using it because what I want, on a row by row basis, is to just sum the value when query1[dq] = query1[iq].  Can I just use this function(which I made for a different pivot table) in this table?  Or put another way, what is the context of the Query1[iq] when the filter context is nothing, is it the whole table?

 

I suspect it may be the latter.  If it is, do I need to do a sumx to sum all rows where Query1[iq] = Query1[dq]?  It's awfully tempting to just do sum(if(query1[iq]=query1[dq],amt,0)) like we would in sql or excel before sumif functions, but again, this is not a normal language.

1 ACCEPTED SOLUTION

Accepted Solutions
Microsoft v-jiascu-msft
Microsoft

Re: Grand totals and the context of numbers

Hi @Ffitzpatrick47,

 

It seems good with your formula in some way. The Filter() will iterate a row context. Maybe you need to remove Max(). Then the formula could be like this:

CALCULATE (
    [sCnt],
    FILTER ( ALL ( Query1[dq] ), Query1[dq] = Query1[iq] )
)

All the rows of table "Query1" where [dq] equal [iq] will return if there aren't any other filter context. 

 

Could you please share the pbix file? DAX formula is dynamic and depends on many aspects like contexts, relationship and filters.

 

Best Regards!

Dale

Community Support Team _ Dale
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

4 REPLIES 4
Microsoft v-jiascu-msft
Microsoft

Re: Grand totals and the context of numbers

Hi @Ffitzpatrick47,

 

It seems good with your formula in some way. The Filter() will iterate a row context. Maybe you need to remove Max(). Then the formula could be like this:

CALCULATE (
    [sCnt],
    FILTER ( ALL ( Query1[dq] ), Query1[dq] = Query1[iq] )
)

All the rows of table "Query1" where [dq] equal [iq] will return if there aren't any other filter context. 

 

Could you please share the pbix file? DAX formula is dynamic and depends on many aspects like contexts, relationship and filters.

 

Best Regards!

Dale

Community Support Team _ Dale
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

Ffitzpatrick47 Helper II
Helper II

Re: Grand totals and the context of numbers

What is the pbix formula.  I should mention that I'm doing this in excel

Highlighted
Microsoft v-jiascu-msft
Microsoft

Re: Grand totals and the context of numbers

Hi @Ffitzpatrick47,

 

You still can try it in Excel. What's the problem if you try it in Excel?

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Microsoft v-jiascu-msft
Microsoft

Re: Grand totals and the context of numbers

Hi @Ffitzpatrick47,

 

Could you please mark the proper answer as solution or share the solution if it's convenient for you? That will be a big help to the others.

 

Best Regards!
Dale

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

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors