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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
New2This
New Member

Max Weekday

Good morning,

 

I want to use a measure in the Data Card visual to calculate the weekday that most cases in my company happen but when I filter by year it does not calculate the max weekday correctly. This is the formula I have:

 

_Max Day = FORMAT(MAXX(
    DISTINCT(Data[DOTW]),
    CALCULATE(COUNT(Data[DOTW]),Data[DOTW] = EARLIER(Data[DOTW]))),"DDDD")
 
It works but when I add a year filter to the data card it filters wrong.
New2This_1-1737638495362.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thanks for the reply from audreygerred , please allow me to provide another insight: 
Hi  @New2This ,

 

Here are the steps you can follow:

1. Create measure.

Test =
var _table=
SUMMARIZE(
    ALLSELECTED('Data'),
    [DOTW],"Count",COUNTX(FILTER(ALLSELECTED('Data'),'Data'[DOTW]=EARLIER('Data'[DOTW])),[DOTW]))
RETURN
FORMAT(
    MAXX(
    FILTER(_table,[Count]=MAXX(_table,[Count])),[DOTW]),"dddd")

2. Result:

vyangliumsft_0-1737699656012.png

 

 

Best Regards,

Liu Yang

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

2 REPLIES 2
Anonymous
Not applicable

Thanks for the reply from audreygerred , please allow me to provide another insight: 
Hi  @New2This ,

 

Here are the steps you can follow:

1. Create measure.

Test =
var _table=
SUMMARIZE(
    ALLSELECTED('Data'),
    [DOTW],"Count",COUNTX(FILTER(ALLSELECTED('Data'),'Data'[DOTW]=EARLIER('Data'[DOTW])),[DOTW]))
RETURN
FORMAT(
    MAXX(
    FILTER(_table,[Count]=MAXX(_table,[Count])),[DOTW]),"dddd")

2. Result:

vyangliumsft_0-1737699656012.png

 

 

Best Regards,

Liu Yang

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

audreygerred
Super User
Super User

Hi! Here is what I used:

DayWithHighestRowCount =
VAR DayCounts =
    ADDCOLUMNS(
        SUMMARIZE(
            'Date',
            'Date'[DOTW Name]
        ),
        "RowCount", CALCULATE(COUNTROWS('Sales'))
    )
VAR MaxDay =
    TOPN(
        1,
        DayCounts,
        [RowCount],
        DESC
    )
RETURN
    MAXX(MaxDay, 'Date'[DOTW Name])
 
It works regardless if I have a year filtered or not. No years - Tuesday is the highest:
audreygerred_0-1737668174329.png

2018 was Friday:

audreygerred_1-1737668199831.png

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.