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
Anonymous
Not applicable

Max for distinctcount in a group

Hi all,

I need to find a number that represents biggest quantity of events in each year and return maximum for whole period of time.

So my source data is below:

gaugeChart.PNG

 

When i add following DAX expression 

Measure = 
CALCULATE (
          DISTINCTCOUNT(Table[Id_Event]); 
          GROUPBY(Table1;Table1[Year])
                       )

I get the following table:

gaugeChart2.PNG

 

What i need know is just a number 8, that represents max events in whole period of time.

Below is link to excel source data but i don't know if it will work as i am inserting link for the first time in this forum.

Does it work?

https://www.dropbox.com/s/nkv5tiotriawhgb/gauge%20chart%20source.xlsx?dl=0

 

Best regards 

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Write these 2 measures

Count = COUNTROWS(Data)
Max count = MAXX(FILTER(VALUES(Data[Year]),[Count]),[Count])

Drag the second measure to a card visual

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Write these 2 measures

Count = COUNTROWS(Data)
Max count = MAXX(FILTER(VALUES(Data[Year]),[Count]),[Count])

Drag the second measure to a card visual

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thank you all for support!

Solution provided by @Ashish_Mathur does the job nicely.

 

Any idea on how to remove all filters but year from final expression ?

Max count = MAXX(FILTER(VALUES(Data[Year]),[Count]),[Count])

I've tried with ALL function but i failed to achive my goal.

v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

To create a measure as below.

 

Max event in the period = CALCULATE(MAX([ID_Event]),ALLEXCEPT(Tabela2,Tabela2[Year]))

Capture.PNG

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others 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.