Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
How to make a column that shows dates in a range of 5 days?
Every 5 days a period would be counted
Example: from 01/01/2022 - 05/01/2022 = Frist period
from 05/01/2022 - 10/01/2022 = Second period
etc...
I already have a calendar table with date and day columns, how to get this date and make a column with periods of 5 days?
Solved! Go to Solution.
You can use these DAX expressions to add Period Columns, Sample file attached for your reference:
Period all date =
VAR _Min_Date =
CALCULATE ( MIN ( 'Table'[Date] ), ALL ( 'Table' ) ) - 1
VAR _Date = 'Table'[Date]
VAR _Day_Between =
DATEDIFF ( _Min_Date, _Date, DAY )
VAR _Period_Number =
ROUNDUP ( _Day_Between / 5, 0 )
RETURN
"Period " & _Period_Number
Period By Month =
VAR _Min_Date =
CALCULATE (
MIN ( 'Table'[Date] ),
ALLEXCEPT ( 'Table', 'Table'[Date].[Month] )
) - 1
VAR _Date = 'Table'[Date]
VAR _Day_Between =
DATEDIFF ( _Min_Date, _Date, DAY )
VAR _Period_Number =
ROUNDUP ( _Day_Between / 5, 0 )
RETURN
"Period " & _Period_Number
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
FIFA World Cup - Medal Records
You can use these DAX expressions to add Period Columns, Sample file attached for your reference:
Period all date =
VAR _Min_Date =
CALCULATE ( MIN ( 'Table'[Date] ), ALL ( 'Table' ) ) - 1
VAR _Date = 'Table'[Date]
VAR _Day_Between =
DATEDIFF ( _Min_Date, _Date, DAY )
VAR _Period_Number =
ROUNDUP ( _Day_Between / 5, 0 )
RETURN
"Period " & _Period_Number
Period By Month =
VAR _Min_Date =
CALCULATE (
MIN ( 'Table'[Date] ),
ALLEXCEPT ( 'Table', 'Table'[Date].[Month] )
) - 1
VAR _Date = 'Table'[Date]
VAR _Day_Between =
DATEDIFF ( _Min_Date, _Date, DAY )
VAR _Period_Number =
ROUNDUP ( _Day_Between / 5, 0 )
RETURN
"Period " & _Period_Number
Output:
If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: www.linkedin.com/in/vahid-dm/
FIFA World Cup - Medal Records