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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
JemmaD
Helper V
Helper V

Calculation group for changing date type

Hi there,

I have visuals displaying data by month, week, and day/week where the x axis is either [start of month], [start of week] or [start of week] and [day of week].

I want to create a calculation group with a 'selected measure()' and then pointing to these three combinations so users can toggle the same visuals by month, week and day. 

Can you help me with the syntax? I tried the below but I get an error. And i'm especially unsure of how to apply both week and day combined in the same measure.

    CALCULATE (
        SELECTEDMEASURE(),
            DATE('Date'[Start of Week] ) )

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @JemmaD ,

 

Try below steps:

1.create below date table:

 

Date = 
ADDCOLUMNS (
    CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2024, 12, 31 ) ),
    "Year", YEAR ( [Date] ),
    "Quarter", ROUNDUP ( MONTH ( [Date] ) / 3, 0 ),
    "Month", MONTH ( [Date] ),
    "Week", WEEKNUM ( [Date] ),
    "Year-Quarter",
        YEAR ( [date] ) & "Q"
            & ROUNDUP ( MONTH ( [Date] ) / 3, 0 ),
    "Year-Month",
        YEAR ( [Date] ) * 100
            + MONTH ( [Date] ),
    "Year-Week",
        YEAR ( [Date] ) * 100
            + WEEKNUM ( [Date] ),
    "weeknum", WEEKDAY ( [Date] )
)

vkongfanfmsft_0-1707127405231.png

2. create field parameters:

Parameter 2 = {
    ("Date", NAMEOF('Date'[Date]), 0),
    ("Month", NAMEOF('Date'[Month]), 1),
    ("Week", NAMEOF('Date'[Week]), 2)
}

 

 

vkongfanfmsft_1-1707127519141.pngvkongfanfmsft_2-1707127538595.png

 

Best Regards,
Adamk Kong

 

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

Hi @JemmaD ,

 

Try below steps:

1.create below date table:

 

Date = 
ADDCOLUMNS (
    CALENDAR ( DATE ( 2022, 1, 1 ), DATE ( 2024, 12, 31 ) ),
    "Year", YEAR ( [Date] ),
    "Quarter", ROUNDUP ( MONTH ( [Date] ) / 3, 0 ),
    "Month", MONTH ( [Date] ),
    "Week", WEEKNUM ( [Date] ),
    "Year-Quarter",
        YEAR ( [date] ) & "Q"
            & ROUNDUP ( MONTH ( [Date] ) / 3, 0 ),
    "Year-Month",
        YEAR ( [Date] ) * 100
            + MONTH ( [Date] ),
    "Year-Week",
        YEAR ( [Date] ) * 100
            + WEEKNUM ( [Date] ),
    "weeknum", WEEKDAY ( [Date] )
)

vkongfanfmsft_0-1707127405231.png

2. create field parameters:

Parameter 2 = {
    ("Date", NAMEOF('Date'[Date]), 0),
    ("Month", NAMEOF('Date'[Month]), 1),
    ("Week", NAMEOF('Date'[Week]), 2)
}

 

 

vkongfanfmsft_1-1707127519141.pngvkongfanfmsft_2-1707127538595.png

 

Best Regards,
Adamk Kong

 

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

 

DataInsights
Super User
Super User

@JemmaD,

 

Try a field parameter consisting of the fields Month, Week, and Day.

 

https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters 





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

Proud to be a Super User!




Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.