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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

DATEDIFF and userelationship (inactive relation)

Hello to everyone,

I have a problem that seems unsolvable.

I want to calculate DATEDIFF between two columns BUT I need to graph these numbers by creation date (which is not the active relationship). So i tried this (and lots of other things) :

Colonne = calculate(DATEDIFF(TOP[A],TOP[B],hour)/24,USERELATIONSHIP(Calendrier[Date],TOP[ticket_creationdate]))
but I have this error message (Il est impossible de déterminer une valeur unique pour la colonne «A» de la table «TOP»...).
 
Exemple of my datas :
- I have an inactive relation between Calendrier[Date] and TOP[ticket_creationdate]
- I also have an active relation between Calendrier[Date] and TOP[ticket_restorationdate]
 
victoriamas_1-1674223175837.png

 

 
Can you help me ?
Thank's
Victoria
2 REPLIES 2
Mikelytics
Resident Rockstar
Resident Rockstar

Hi @Anonymous 

 

If you want to build this in DAX I think you will create unnecessary complexity. A solution might be something like this:

 

Measure = 
CALCULATE(
   SUMX(
      TOP,
      [B]-[A]
   )
   USERELATIONSHIP(Calendrier[Date],TOP[ticket_creationdate])
)

 

or [A] and [B] switched

 

Measure = 
CALCULATE(
   SUMX(
      TOP,
      [A]-[B]
   )
   USERELATIONSHIP(Calendrier[Date],TOP[ticket_creationdate])
)

 

 

Why do you not calculate the difference in Power Query first and then Use DAX with USERELATIONSHIP on the newly createx column?

 

Best regards
Michael
-----------------------------------------------------
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your thumbs up!
@ me in replies or I'll lose your thread.

------------------------------------------------------------------
Visit my blog datenhungrig which I recently started with content about business intelligence and Power BI in German and English or follow me on LinkedIn!
Anonymous
Not applicable

First of all, thank you for your feedback. Indeed, I did this formula in the first place, but for the need of a graph I need to have a calculated field with the creation date, otherwise the graph is wrong.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.