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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Conditional Column

Hi Folks,

I am working on creating a conditional column like the below:

Condition

Values in new column

contract to expire in 15 days from the current date

 - 15 days

contract to expire in 30 days from the current date

 - 30 days

contract to expire in 60 days from the current date

 - 60 days

contract to expire in 90 days from the current date

 - 90 days

 

I want the new column to be used as a filter/slicer in my report. My desired slicer outcome is

  • if I select 60 days, all contracts expiring from 'today to 60 days in future' should show up.
  • if I select 90 days, all contracts from 'today to 90 days' should show up.

But what I get is:

  • if I select 90 days, I get only contracts expiring between 60 and 90 days

 Can anyone please help me here?

The logic used by me- if [expiry days]>0 and [expiry days]<60 then 60 days
                              if [expiry days]>0 and [expiry days]<90 then 90 days

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello @Anonymous ,

 

You can achieve the desired result by separately creating column with each of this condition.

Days = DATEDIFF(TODAY(),'Date'[Date],DAY)
 
15 days = if('Date'[Days]<15,"15 days")
30 days = if('Date'[Days]<30,"30 days")
60 days = if('Date'[Days]<60,"60 days")
90 days = if('Date'[Days]<90,"90 days")
 
then combine values of all the column in one column
bridge = COMBINEVALUES("|",'Date'[15 days],'Date'[30 days],'Date'[60 days],'Date'[90 days])
 
create new table like below,
Slicer =
DISTINCT (
UNION (
SELECTCOLUMNS (
'Date',
"Selection", 'Date'[15 days],
"bridge", 'Date'[bridge]
),
SELECTCOLUMNS (
'Date',
"Selection",'Date'[30 days],
"bridge", 'Date'[bridge]
),
SELECTCOLUMNS ('Date',
"selection",'Date'[60 days],
"bridge",'Date'[bridge]
),
SELECTCOLUMNS ('Date',
"Selection",'Date'[90 days],
"bridge",'Date'[bridge]
)))
 
join the twe table by bridge column and use selection column in slicer.
 

Please find my attached pbix file here pbix file 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hello @Anonymous ,

 

try using with:    if [expiry days]>0 and [expiry days]<90 then 90 days

                              if [expiry days]>0 and [expiry days]<60 then 60 days


                              

Anonymous
Not applicable

Thanks but this does not help

Anonymous
Not applicable

Hello @Anonymous ,

 

You can achieve the desired result by separately creating column with each of this condition.

Days = DATEDIFF(TODAY(),'Date'[Date],DAY)
 
15 days = if('Date'[Days]<15,"15 days")
30 days = if('Date'[Days]<30,"30 days")
60 days = if('Date'[Days]<60,"60 days")
90 days = if('Date'[Days]<90,"90 days")
 
then combine values of all the column in one column
bridge = COMBINEVALUES("|",'Date'[15 days],'Date'[30 days],'Date'[60 days],'Date'[90 days])
 
create new table like below,
Slicer =
DISTINCT (
UNION (
SELECTCOLUMNS (
'Date',
"Selection", 'Date'[15 days],
"bridge", 'Date'[bridge]
),
SELECTCOLUMNS (
'Date',
"Selection",'Date'[30 days],
"bridge", 'Date'[bridge]
),
SELECTCOLUMNS ('Date',
"selection",'Date'[60 days],
"bridge",'Date'[bridge]
),
SELECTCOLUMNS ('Date',
"Selection",'Date'[90 days],
"bridge",'Date'[bridge]
)))
 
join the twe table by bridge column and use selection column in slicer.
 

Please find my attached pbix file here pbix file 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.