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
mogunase1
Helper III
Helper III

Custom Date filter with Month and YTD

Hi,

 

I need date filter in which it should have both Month wise and current YTD .

 

Example -  

mogunase1_0-1624977666481.png

From the above SS, i can select month wise data also Current YTD (i.e., 2021 YTD)

 

Please help me to resolve this.

 

Thanks,

Mohanraj

 

@amitchandak @Jihwan_Kim @Fowmy 

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @mogunase1 ,

Please follow the below  steps to get it:

1. Create a auxiliary table, you can refer the solution in the following thread:

    Looking for difference between two values by filters

Table 2 = UNION ( VALUES ( 'Table'[MonthYear] ), ROW ( "MonthYear", "YTD" ) )

2. Create a measure as below to get the different value base on MonthYear selection (current year YTD and normal aggregation)

Measure =
SWITCH (
    SELECTEDVALUE ( 'Table 2'[MonthYear] ),
    "YTD",
        TOTALYTD (
            SUM ( 'Table'[# of incidents] ),
            'Table'[Date],
            YEAR ( 'Table'[Date] ) = YEAR ( TODAY () )
        ),
    CALCULATE (
        SUM ( 'Table'[# of incidents] ),
        FILTER ( 'Table', 'Table'[MonthYear] = SELECTEDVALUE ( 'Table 2'[MonthYear] ) )
    )
)

3. Create a slicer base on the field [MonthYear] of Table 2

Best Regards

Community Support Team _ Rena
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

3 REPLIES 3
v-yiruan-msft
Community Support
Community Support

Hi @mogunase1 ,

Please follow the below  steps to get it:

1. Create a auxiliary table, you can refer the solution in the following thread:

    Looking for difference between two values by filters

Table 2 = UNION ( VALUES ( 'Table'[MonthYear] ), ROW ( "MonthYear", "YTD" ) )

2. Create a measure as below to get the different value base on MonthYear selection (current year YTD and normal aggregation)

Measure =
SWITCH (
    SELECTEDVALUE ( 'Table 2'[MonthYear] ),
    "YTD",
        TOTALYTD (
            SUM ( 'Table'[# of incidents] ),
            'Table'[Date],
            YEAR ( 'Table'[Date] ) = YEAR ( TODAY () )
        ),
    CALCULATE (
        SUM ( 'Table'[# of incidents] ),
        FILTER ( 'Table', 'Table'[MonthYear] = SELECTEDVALUE ( 'Table 2'[MonthYear] ) )
    )
)

3. Create a slicer base on the field [MonthYear] of Table 2

Best Regards

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Jihwan_Kim
Super User
Super User

Picture1.png

 

https://www.dropbox.com/s/lhhkd48kzre6tdk/mogv4.pbix?dl=0 

 

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


amitchandak
Super User
Super User

@mogunase1 , You need to create an independent table, and based on each value you need to make a decision.

 

If (selectedvalue(Slicer[Slicer]) ="YTD", [YTD Measure], [Monthy Measure])

 

Make sure you need to handle these value in you monthly measure too.

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.