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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
rpaez
Frequent Visitor

Estimar cantidad de meses entre fecha de compra y fecha actual

Hola amigos, requiero su colaboración,  tengo una tabla de Activos que contiene la compra de activos de la empresa, cada activo tiene un nombre y una fecha de compra, y lo que necesito es determinar la cantidad de meses transcurridos entre la fecha de compra y una fecha que seleccione en un visula de filtro usando una Tabla de fecha creada y relacionada con la Tabla de Activos, parece simple pero no logro llegar a la formula.

Agradezco mucho la colaboración

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

Hi @rpaez ,

Is your problem solved? If the two tables are related, after you select a date in the slicer, it will filter the Assets visual, which is not expected. I suggest you change the relationship to inactive, and create a measure:

DateDiff =
DATEDIFF (
    MAX ( 'Assets'[Purchase date] ),
    SELECTEDVALUE ( 'Date'[Date] ),
    MONTH
)

Result:

vyanjiangmsft_0-1687946212542.png

I attach my sample below for your reference.

 

Best regards,

Community Support Team_yanjiang

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

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @rpaez ,

Is your problem solved? If the two tables are related, after you select a date in the slicer, it will filter the Assets visual, which is not expected. I suggest you change the relationship to inactive, and create a measure:

DateDiff =
DATEDIFF (
    MAX ( 'Assets'[Purchase date] ),
    SELECTEDVALUE ( 'Date'[Date] ),
    MONTH
)

Result:

vyanjiangmsft_0-1687946212542.png

I attach my sample below for your reference.

 

Best regards,

Community Support Team_yanjiang

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

@rpaez , You can have a measure like

 

sumx(table,datediff( table[purchase date], selectedvalue(date[Date]), month) )

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.