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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Remove no of days from Date with DAX

Hi All,


The requirement is i have to remove days(Time) from Date column with DAX(calculated column or measure)
Time Column - Text
Date Column - Date(dd-mm-yy)

Example - if the Time column has 2,00 days,  Date colum (17th Jan 22) = 17th jan 22-3days
the output should come - 15th Jan 22
Any advise please?

LikhithaVG123_0-1672125206521.png

Thanks

1 ACCEPTED SOLUTION

I see, 

the issue is with the format ",00" the most direct way to solve this would be to change the columns data type to number. Here is an dax alternative:

Measure 30 =
var _date = MAX('Table (19)'[Column1])
var _diff = value(max('Table (19)'[Column2]))/100
return

_date-_diff

The 14,00 is converted for example to 1400 with VALUE and this is why your numbers don't match.
ValtteriN_0-1672142325273.png

 








Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
ValtteriN
Super User
Super User

Hi,

You can use e.g. MAX/SELECTEDVALUE combined with a simple subtraction:

ValtteriN_1-1672126370836.png

dax:

Measure 30 =
var _date = MAX('Table (19)'[Column1])
var _diff = MAX('Table (19)'[Column2])
return

_date - _diff

ValtteriN_2-1672126406464.png

 


I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!

My LinkedIn: https://www.linkedin.com/in/n%C3%A4ttiahov-00001/




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Hi @ValtteriN 

Thanks for the solution. But can we convert same measure to calculated column?
beacuse when i am creating Measure . i am getting circular dependency error (if we use combination of more calcu,ated columns and measures their might be circular dependency) to avoid can we convert same measure to calculated column ??

i have tried to convert same into calculated column but it is giving incorrect result

 

Please advise

Anonymous
Not applicable

Hi ValtteriN
I have tried your formula - Getting incorrect result as below screenshot
Pleae advise further.

LikhithaVG123_0-1672140406238.png
Thanks

 

 

I see, 

the issue is with the format ",00" the most direct way to solve this would be to change the columns data type to number. Here is an dax alternative:

Measure 30 =
var _date = MAX('Table (19)'[Column1])
var _diff = value(max('Table (19)'[Column2]))/100
return

_date-_diff

The 14,00 is converted for example to 1400 with VALUE and this is why your numbers don't match.
ValtteriN_0-1672142325273.png

 








Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Fabcon_Europe_Social_Bogo

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.