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
logrt
Frequent Visitor

Data segmentation date as DAX formula

Greetings I have a problem with a table, the calculation of one of its columns depends on an arbitrary date, for example:

Column-if(date-"10-09-2020",1,0)

I need to analyze and graph this table by varying this arbitrary date, I had thought of a slicer but from what I understand it is NOT possible to get the dates that appear there for my formula, is there any other option?

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

Hi @logrt ,

 

We can create a date table to be the arbitrary date and create a measure to meet your requirement.

 

1. Create a date table, then create a slicer using it.

 

Date = CALENDARAUTO()

 

data1.jpg

 

2. Then we can create a measure to get the result.

 

Column-if = 
var _select = SELECTEDVALUE('Date'[Date])
var _condition = IF(_select=MAX('Table'[Date]),1,0)
return
SUM('Table'[value]) * _condition

 

data2.jpg

 

data3.jpg

 

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data?

It will be helpful if you can show us the exact expected result based on the tables.

 

Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

2 REPLIES 2
v-zhenbw-msft
Community Support
Community Support

Hi @logrt ,

 

We can create a date table to be the arbitrary date and create a measure to meet your requirement.

 

1. Create a date table, then create a slicer using it.

 

Date = CALENDARAUTO()

 

data1.jpg

 

2. Then we can create a measure to get the result.

 

Column-if = 
var _select = SELECTEDVALUE('Date'[Date])
var _condition = IF(_select=MAX('Table'[Date]),1,0)
return
SUM('Table'[value]) * _condition

 

data2.jpg

 

data3.jpg

 

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data?

It will be helpful if you can show us the exact expected result based on the tables.

 

Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

amitchandak
Super User
Super User

@logrt , Upu can not use slicer value in a column.

You can try in column-like

 

if([date] > date(2019,10,09),1,0)

 

You can create a measure like

if(max(Date[date]) > selectedvalue(Date[Date]),1,0)

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

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.