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.
I would like to create a column using dax that gives me a count of payroll, starting over each year and increasing semi-monthly on the 1st and 16th of each month. For example, the date table will show:
1/11/2019 | 1 |
1/12/2019 | 1 |
1/13/2019 | 1 |
1/14/2019 | 1 |
1/15/2019 | 2 |
1/16/2019 | 2 |
1/17/2019 | 2 |
1/18/2019 | 2 |
1/19/2019 | 2 |
1/20/2019 | 2 |
1/21/2019 | 2 |
1/22/2019 | 2 |
1/23/2019 | 2 |
1/24/2019 | 2 |
1/25/2019 | 2 |
1/26/2019 | 2 |
1/27/2019 | 2 |
1/28/2019 | 2 |
1/29/2019 | 2 |
1/30/2019 | 2 |
1/31/2019 | 2 |
2/1/2019 | 3 |
2/2/2019 | 3 |
Solved! Go to Solution.
Try this
NewCol = VAR Base_ = (2 * ( MONTH ( CalendarTable[Date] ) - 1 )) + 1 RETURN SWITCH (TRUE (); DAY ( CalendarTable[Date] ) < 16; Base_; Base_ + 1 )
Hi @bice_cold
Try this for a calculated column:
NewCol = SWITCH ( TRUE (), VAR Base_ = (2 * ( MONTH ( Table1[Date] ) - 1 )) + 1 RETURN DAY ( Table1[Date] ) < 16, Base_, Base_ + 1 )
Thanks for the response @AlB . I tried this, but I got this error:
"Failed to resolve name 'Base_'. It is not a valid table, variable, or function name."
Try this
NewCol = VAR Base_ = (2 * ( MONTH ( CalendarTable[Date] ) - 1 )) + 1 RETURN SWITCH (TRUE (); DAY ( CalendarTable[Date] ) < 16; Base_; Base_ + 1 )
This worked, thanks so much! I've never come across something like this before. It's a really interesting and creative solution.
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 |
---|---|
112 | |
99 | |
73 | |
72 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |