Forum Discussion
Nini1
4 years agoFrequent Visitor
Creating Column/Measure depending on variables
Hello everyone, It's not been a long time I'm using Power Bi and need your help to solve this issue. I have the following data ID ID2 Date1 Date2 1 2 9/29/2021 10/30/2021 2 ...
- 4 years ago
Hi Nini1 ,
You can try below code:-
Time Period = VAR MIN_P_ = CALCULATE ( MIN ( 'Dates_range'[Date1] ), ALL ( Dates_range ) ) VAR MAX_P_ = CALCULATE ( MAX ( 'Dates_range'[Date1] ), ALL ( Dates_range ) ) VAR Time_Per = IF ( AND ( 'Dates_range'[Date2] >= MIN_P_, 'Dates_range'[Date2] <= MAX_P_ ), Dates_range[Date2] ) RETURN Time_PerOuput:-
Thanks,
Samarth
Nini1
4 years agoFrequent Visitor
Samarth_18 Thank you very much and should I change it when e.g. Date2 is from another table? I should write the code differently, right?
Samarth_18
4 years agoCommunity Champion
Nini1 I think it should work in that case as well.