Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi All,
I'm losing my mind trying to resolve this problem if you can help me please :
I've got a table getting all my product with a start and end date of the promotion :
so, I want to use this table to calculate the number of days which the product was in promotion
I have in my mind to build a new table with a unique date from the start to the end date
any idea how to do this?
If you have another idea, I'll be grateful for your help.
Regards
Solved! Go to Solution.
HI @nkasdali,
You can simply use below formula to create expand table with detail date range :
Detail Table = VAR _calendar = CALENDAR ( MINX ( 'Product', [Start] ), MAXX ( 'Product', [End] ) ) RETURN SELECTCOLUMNS ( FILTER ( CROSSJOIN ( 'Product', _calendar ), [Date] >= [Start] && [Date] <= [End] ), "Product", [Product], "Date", [Date] )
Regards,
Xiaoxin Sheng
HI @nkasdali,
You can simply use below formula to create expand table with detail date range :
Detail Table = VAR _calendar = CALENDAR ( MINX ( 'Product', [Start] ), MAXX ( 'Product', [End] ) ) RETURN SELECTCOLUMNS ( FILTER ( CROSSJOIN ( 'Product', _calendar ), [Date] >= [Start] && [Date] <= [End] ), "Product", [Product], "Date", [Date] )
Regards,
Xiaoxin Sheng
Hi,
If I understand correctly you want to have the number of days between the start and end date? A method for doing this is using the DATEDIFF function in a Calculated Column.
Number of Days = DATEDIFF(YourTableName[StartDate].[Date],YourTableName[EndDate].[Date],DAY)
Let me know if this works!
Cheers
Alex
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
100 | |
81 | |
70 | |
62 |
User | Count |
---|---|
148 | |
116 | |
104 | |
90 | |
65 |