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.
My logic is this:
If variable date2 is not blank for this each ID, then output date2.
If date2 is blank, then output a random number between 0 and the most recent month of column date1.
So the sample data is like this:
ID | date1 | date2 | output |
1 | 2023-02-28 | 3 | 3 |
2 | 2023-05-31 | 5 | |
3 | 2022-12-31 | 0 | 0 |
4 | 2023-04-30 | 1 | 1 |
5 | 2023-01-31 | 4 | 4 |
6 | 2023-03-31 | 5 |
This is my function:
Hi @adaxx ,
MAX function accepts either a column
=
MAX ( table[column] )
or two scalar values
=
MAX ( 1, 2 )
=
MAX ( MONTH ( table[date column] ), 100 )
This part of your formula retuns just ONE scalar value
=
MONTH ( 'table'[date2] )
Below is your formula modified so the syntax is correct but I am not sure what you are trying to achieve here. You also did not mention if it is a measure or a calc column
MO =
IF (
ISBLANK ( 'table'[Date1] ) = FALSE,
'table'[Date1],
RANDBETWEEN ( 0, MONTH ( 'table'[date2] ) )
)
Proud to be a Super User!
Try this. You might need to tweak the calculated column measure a little bit to tailor fit your needs.
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 | |
100 | |
76 | |
64 | |
63 |
User | Count |
---|---|
142 | |
105 | |
102 | |
80 | |
67 |