Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi everyone,
I've got a table that contains the price list of some products that my company buys from a certain supplier:
For each item there are the start date and the end date of the price shown in the line (31/12/2099 means the the price is currently valid).
My goal is to find out if there are any gaps between dates, so I need to calculate, for each item, the difference between the ValidityEndingDate and the next ValidityStartingDate:
Here is the PBIX file: https://www.dropbox.com/s/3q2rldzekcbjsh3/Days%20between%20dates.pbix?dl=0
I hope it's all clear. Thank you.
Solved! Go to Solution.
A calculated column in DAX:
ColumnZ = var _item = 'Table'[Item]
var _endDate = 'Table'[ValidityEndingDate]
RETURN
CALCULATE(MIN('Table'[ValidityStartingDate]), FILTER('Table', 'Table'[Item] = _item && 'Table'[ValidityStartingDate] > _endDate))
You can then use DATEDIFF in another column to get the days between the column and the ending date.
I haven't really tested it so please do that.
A calculated column in DAX:
ColumnZ = var _item = 'Table'[Item]
var _endDate = 'Table'[ValidityEndingDate]
RETURN
CALCULATE(MIN('Table'[ValidityStartingDate]), FILTER('Table', 'Table'[Item] = _item && 'Table'[ValidityStartingDate] > _endDate))
You can then use DATEDIFF in another column to get the days between the column and the ending date.
I haven't really tested it so please do that.
That's great @HotChilli ! I've created this column:
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
100 | |
72 | |
44 | |
38 | |
29 |
User | Count |
---|---|
156 | |
92 | |
62 | |
44 | |
41 |