Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
I have created a date table and now I want a column that returns a number incremented by 1 every 1st and 15th of the month.
Here is an example:
2023-12-12 | 1 |
2023-12-13 | 1 |
2023-12-14 | 1 |
2023-12-15 | 2 |
2023-12-16 | 2 |
2023-12-17 | 2 |
Any idea on how to achieve this? Thanks !
Solved! Go to Solution.
@Whoule Try this:
Column =
VAR __Date = [Date]
VAR __Day = DAY( [Date] )
VAR __Table = FILTER( 'Table', [Date] <= __Date && ( DAY( [Date] ) = 1 || DAY( [Date] = 15 ) )
VAR __Result = COUNTROWS( __Table )
RETURN
__Result
Hi @Ahmedx,
This doesn't work as some months have 31 days so after one month dividing by 15 doesnt work anymore.
Still doesn't work. The ID needs to change not every 15 days but only on the 1st and 15th of each month.
where there are 31 days or 29 what to do
@Whoule Try this:
Column =
VAR __Date = [Date]
VAR __Day = DAY( [Date] )
VAR __Table = FILTER( 'Table', [Date] <= __Date && ( DAY( [Date] ) = 1 || DAY( [Date] = 15 ) )
VAR __Result = COUNTROWS( __Table )
RETURN
__Result
User | Count |
---|---|
84 | |
76 | |
75 | |
43 | |
36 |
User | Count |
---|---|
109 | |
56 | |
52 | |
48 | |
43 |