Forum Discussion
wemsomba
5 months agoNew Member
DATEDIFF DAX
Hello everyone. I want to get the difference in days between two or three columns from two different tables. I have "Name","firstcontact","Secondcontact","ThirdContact", and "FourthContact" as column...
- 5 months ago
Power BI does not think like Excel. Unpivot your data to these columns
Name
Contact
let Source = #table(null,{{ "James ", "1/1/2026 01:30:00 ", "1/15/2026 01:30:00 ", "1/17/2026 01:30:00 ", "1/19/2026 01:30:00 "}, { "Anthony ", "1/17/2026 01:30:00 ", "1/19/2026 01:30:00 ", "1/21/2026 01:30:00 ", "1/22/2026 01:30:00 "}, { "Okito ", "1/17/2026 01:02:00 ", "1/16/2026 01:30:00 ", "1/22/2026 01:30:00 ", "1/31/2026 01:30:00 "}}), #"Unpivoted Other Columns" = Table.UnpivotOtherColumns(Source, {"Column1"}, "Attribute", "Contact"), #"Removed Other Columns" = Table.SelectColumns(#"Unpivoted Other Columns",{"Column1", "Contact"}), #"Renamed Columns" = Table.RenameColumns(#"Removed Other Columns",{{"Column1", "Name"}}), #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Name", type text}, {"Contact", type datetime}}) in #"Changed Type"That way the number of contacts for each name can be flexible.
Then you can run the standard math functions against your data, including min and max difference between values
To compare any two names you would use measures that can modify the filter context, or visual calculations.
Oftentimes a visual solution may be easier.
What is your expected outcome based on the sample data you provided?
v-nmadadi-msft
5 months agoCommunity Support
Hi wemsomba
May I check if this issue has been resolved? If not, Please feel free to contact us if you have any further questions.
Thank you