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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Dynamic MoM and WoW change calculation based on slicer selection

I have a table with date and ticket id. I have a measure that shows created tickets. I also have date tables with slicer options like below

date(mm/dd/yyyy)ticket
6/21/20231
6/22/20232
6/27/20233
7/1/20234
7/2/20235
7/3/20236
7/7/20237
7/10/20238
7/12/20239
7/12/202310

Created tickets shows the right value as per slicer selection

data142536_0-1691023304843.png

however, I want to write a  MoM and WoW change measure that shows the respective calculations. I tried something like this but its not working. Please let me know where I am going wrong.

MoM WoW Change =
VAR SelectedType = SELECTEDVALUE('Dynamic Date Scope'[Type])
VAR SelectedStartDate = MIN('Dynamic Date Scope'[Date])

RETURN
SWITCH(
    TRUE(),
    SelectedType = "Monthly",
    VAR PreviousMonthStartDate = EOMONTH(SelectedStartDate, -1) + 1
    VAR PreviousMonthEndDate = EOMONTH(SelectedStartDate, -1)
    VAR PreviousMonthCases =
        CALCULATE(
            [CreatedTix],
            FILTER(
                ALL('DateTable'),
                'DateTable'[Date] >= PreviousMonthStartDate && 'DateTable'[Date] <= PreviousMonthEndDate
            )
        )
    RETURN
        [CreatedTix] - PreviousMonthCases,
   
    SelectedType = "Weekly",
    VAR PreviousWeekStartDate = SelectedStartDate - 7
    VAR PreviousWeekEndDate = SelectedStartDate - 1
    VAR PreviousWeekCases =
        CALCULATE(
            [CreatedTix],
            FILTER(
                ALL('DateTable'),
                'DateTable'[Date] >= PreviousWeekStartDate && 'DateTable'[Date] <= PreviousWeekEndDate
            )
        )
    RETURN
        [CreatedTix] - PreviousWeekCases,

    BLANK()
)
 
My expected solution is 
data142536_1-1691023387539.png

July 2023 shows 4 as july had (7-3=4) increase in tickets. 

Here's the sample pbix. Please help. test.pbix

0 REPLIES 0

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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