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
NISHA_S
Resolver I
Resolver I

Date slicer data showing based on conditions

I have to create a report from a table.

i need to add  a date slicer which should be like this.

slicer.PNG

i can't consider any date column from my table for creating slicer.The thing is if i click on jan 2022

report data should be filter out data based on these condition...and also i can't add 2021 slicer date here,can add only upto march date now .

 

jan 2022
    policy_effective_date < '1/1/2022' AND policy_expiration_date >= '12/31/2020'
 
 feb 2022
 policy_effective_date < '2/1/2022' AND policy_expiration_date >= '1/31/2021'
 
 mar 2022
 policy_effective_date < '3/1/2022' AND policy_expiration_date >= '2/28/2021'
 
here am attaching my pbx file  link
plse help////
1 ACCEPTED SOLUTION
v-angzheng-msft
Community Support
Community Support

Hi, @NISHA_S 

Create the following calculated column, then create the slicer

 

Column = 
SWITCH(
    TRUE(),
    [policy_effective_date]<dt"2022-1-1"&&[policy_expiration_date]>=dt"2020-12-31",FORMAT(dt"2022-1-1","dd-MMMM-yyyy"),
    [policy_effective_date]<dt"2022-2-1"&&[policy_expiration_date]>=dt"2021-1-31",FORMAT(dt"2022-2-1","dd-MMMM-yyyy"),
    [policy_effective_date]<dt"2022-3-1"&&[policy_expiration_date]>=dt"2021-1-31",FORMAT(dt"2022-3-1","dd-MMMM-yyyy")
)

 

Result:

vangzhengmsft_0-1647321758855.png

If you don't want to create a column in the original table, you can create a filter measure and filter items with a measure equal to 1 in the filter pane.

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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-angzheng-msft
Community Support
Community Support

Hi, @NISHA_S 

Create the following calculated column, then create the slicer

 

Column = 
SWITCH(
    TRUE(),
    [policy_effective_date]<dt"2022-1-1"&&[policy_expiration_date]>=dt"2020-12-31",FORMAT(dt"2022-1-1","dd-MMMM-yyyy"),
    [policy_effective_date]<dt"2022-2-1"&&[policy_expiration_date]>=dt"2021-1-31",FORMAT(dt"2022-2-1","dd-MMMM-yyyy"),
    [policy_effective_date]<dt"2022-3-1"&&[policy_expiration_date]>=dt"2021-1-31",FORMAT(dt"2022-3-1","dd-MMMM-yyyy")
)

 

Result:

vangzhengmsft_0-1647321758855.png

If you don't want to create a column in the original table, you can create a filter measure and filter items with a measure equal to 1 in the filter pane.

Please refer to the attachment below for details.

Hope this helps.

 

 

Best Regards,
Community Support Team _ Zeon Zheng


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

amitchandak
Super User
Super User

@NISHA_S , You should use a date table with month year, preferably independent date table

if you select Jan 2022

// policy_effective_date < '1/1/2022' AND policy_expiration_date >= '12/31/2020'

measure  =

var _max = minx(filter(allselected('Date'), 'Date'[Date])

var _min = eomonth(_max, -13)

return

calculate(sum(Table[Value]), filter(Table, Table[ policy_effective_date] < _max && Table[policy_expiration_date] >= _min ) )

can u please tell  about what is this Table[Value] means? am not using any value named column here

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.