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
AltGr9
Helper I
Helper I

Applying MAX to Summerize

Hello all, I have a summerize statement that returns a count of rows by date, and I'm trying to find the max date with a count greater than 10. 
 
Here is what I have so far, but it doesn't want to accept _s[Count].  Any help would be appreciated.
 

 

 

Max Date With Count Greater Than 10 =
VAR _s = SUMMARIZE
( 
 'Fact Table'
,'Fact Table'[Date]
,"Count", COUNT('Fact Table'[Date])
)
RETURN
CALCULATE( MAXX(_s, [Date]), _s[Count] > 10 )

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture.

One thing that I want to share is, try to use addcolumns & summarize functions together, instead of using only summarize when adding expressions to the virtual summarized table.

The reason is that, not very often happen in general cases, but in some cases (in fact, quite a lot...), if authors use only summarize function and add expressions into the virtual summarized table, there might be an issue in creating correct numbers and having a good performance.

 

Picture2.png

 

Max Date With Count Greater Than 10 =
VAR _s =
FILTER (
ADDCOLUMNS (
SUMMARIZE ( 'Fact Table', 'Fact Table'[Date] ),
"Count", CALCULATE ( COUNT ( 'Fact Table'[Date] ) )
),
[Count] > 10
)
RETURN
MAXX ( _s, 'Fact Table'[Date] )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

7 REPLIES 7
v-robertq-msft
Community Support
Community Support

Hi, @AltGr9 

Have you followed the DAX formula posted by Jihwan_Kim to find the solution to your problem?

If so, would you like to mark his reply as a solution so that others can learn from it too?

 

Thanks in advance!

How to Get Your Question Answered Quickly 

 

Best Regards,

Community Support Team _Robert Qin

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

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture.

One thing that I want to share is, try to use addcolumns & summarize functions together, instead of using only summarize when adding expressions to the virtual summarized table.

The reason is that, not very often happen in general cases, but in some cases (in fact, quite a lot...), if authors use only summarize function and add expressions into the virtual summarized table, there might be an issue in creating correct numbers and having a good performance.

 

Picture2.png

 

Max Date With Count Greater Than 10 =
VAR _s =
FILTER (
ADDCOLUMNS (
SUMMARIZE ( 'Fact Table', 'Fact Table'[Date] ),
"Count", CALCULATE ( COUNT ( 'Fact Table'[Date] ) )
),
[Count] > 10
)
RETURN
MAXX ( _s, 'Fact Table'[Date] )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Jihwan_Kim
Super User
Super User

Hi,

I am not sure how the measure operates without seeing the actual sample file. However, what I can suggest based on what I see is that, inside VAR in your measure, you can try to filter _s table first, and then write RETURN MAXX(..... 

If you can share your sample pbix file's link, it will be helpful.

Thank you.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Hi Thanks for your help.

 

Is this the link you asked for? It says "People in your organization" so I don't know if you'll have access.

 

https://app.powerbi.com/links/yOLAOU1UWC?ctid=f8a5e453-f912-4b49-a15e-7644e3993976&pbi_source=linkSh...

Hi, 

Sorry that if I was not clear.

I was asking for the sample power bi desktop file's link, not your power bi service link.

Thank you.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


One final thing: I would like it to be dynamic, so not using a calculated table.

Hey thanks, I've sent you the link privately.

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.

Top Solution Authors