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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Key123
Regular Visitor

Most Frequent value working with slicer

I need help with the displaying the most frequent value in Card visualisation while the selected filters in slicers. 

I have tried to create new measure with the most frequest month:

TopMonth =
CALCULATE(SELECTEDVALUE('Tablename'[Date].[Month]),
TOPN(1,ALL('Tablename'),[Date].[Month],DESC))
 
But after putting new measure in card visualisation the result is the same month, even the filters in slicers are selected. 
Could you please help with the working formula for the most frequent value, which is working with the slicers? 
Thank you

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Key123 ,

 

Based on your description, I created simple samples and you can check the results below:

vtianyichmsft_0-1700039062402.png

vtianyichmsft_1-1700039093423.png

 

Most Frequent = 
var _table=ADDCOLUMNS(ALLSELECTED('Table'),"year",YEAR('Table'[Data]),"month",MONTH('Table'[Data]))
var _b=  SUMMARIZE(_table,[month],"count of id",COUNT('Table'[ID]))
return CALCULATE(MAXX(FILTER(_b,[count of id]=MAXX(_b,[count of id])),[month]))

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

5 REPLIES 5
Anonymous
Not applicable

Hi @Key123 ,

 

Based on your description, I created simple samples and you can check the results below:

vtianyichmsft_0-1700039062402.png

vtianyichmsft_1-1700039093423.png

 

Most Frequent = 
var _table=ADDCOLUMNS(ALLSELECTED('Table'),"year",YEAR('Table'[Data]),"month",MONTH('Table'[Data]))
var _b=  SUMMARIZE(_table,[month],"count of id",COUNT('Table'[ID]))
return CALCULATE(MAXX(FILTER(_b,[count of id]=MAXX(_b,[count of id])),[month]))

 

An attachment for your reference. Hope it helps!

 

Best regards,
Community Support Team_ Scott Chang

 

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

 

Ashish_Mathur
Super User
Super User

Hi,

Your requirement is not clear.  Clearly show the result you are expecting.


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

Hello, 

I have the column with dates: 

Key123_0-1699990563071.png

Trying to make card type visualisation with the most frequent Month based on the filters in slicers.

How the result should be shown: 

Key123_1-1699990765204.png

The example of slicer:

Key123_2-1699990797955.png

While selecting specific year in slicer, the value in the card visualisation (TopMonth) is not changing. 

 

Hi,

Create a Calendar Table with calculated column formulas for Year, Month name and Month number.  Sort the Month name column by the Month number.  Create the year slicer from the Calendar Table.  Create a relationship (Many to One and Single) from the Date column of your Data Table to the Date column of the Calendar Table.  Write these measures

Measure = countrows(Data)

Meausre 1 = MAXX(VALUES(Calendar[Month name]),[Measure])

Hope this helps.


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

Here's something using some of my own sample data: 

Most common month = 
var months = VALUES('Table'[Month])
return TOPN(1, months, 'Table'[Month], ASC, COUNT('Table'[Month]))

vicky__0-1699912044891.png

Hope this helps.

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors