Forum Discussion
DAX measure
I am new to DAX and Iam trying to convert the below column to measure, but somehow didnot found the luck, can someone help me on this
IF ('Table A'[Ship Date] = BLANK (),BLANK (),
IF ('Table A'[Order Creation Date] = BLANK (),BLANK (),
IF ('Table A'[Ship Date] - 'Table A'[Order Creation Date] < 0,-1,
'Table A'[Ship Date] - 'Table A'[Order Creation Date])))
TIA
Hi, Sri57
wrap your column name in MIN(), MAX()
use some_bih code with MIN() or MAX()like below
measure = IF ( ISBLANK ( min('Table A'[Ship Date] )), BLANK (), IF ( ISBLANK ( min('Table A'[Order Creation Date] )), BLANK (), IF ( DATEDIFF ( min('Table A'[Order Creation Date]), min('Table A'[Ship Date]), DAY ) < 0, -1, DATEDIFF ( min('Table A'[Order Creation Date]), min('Table A'[Ship Date]), DAY ) ) ) )
7 Replies
- Dangar332
Resident Rockstar
Hi, Sri57
wrap your column name in MIN(), MAX()
use some_bih code with MIN() or MAX()like below
measure = IF ( ISBLANK ( min('Table A'[Ship Date] )), BLANK (), IF ( ISBLANK ( min('Table A'[Order Creation Date] )), BLANK (), IF ( DATEDIFF ( min('Table A'[Order Creation Date]), min('Table A'[Ship Date]), DAY ) < 0, -1, DATEDIFF ( min('Table A'[Order Creation Date]), min('Table A'[Ship Date]), DAY ) ) ) ) - some_bih
Community Champion
Hi Sri57
Try below (helped with AI)
Measure =
IF (
ISBLANK ( 'Table A'[Ship Date] ),
BLANK (),
IF (
ISBLANK ( 'Table A'[Order Creation Date] ),
BLANK (),
IF (
DATEDIFF ( 'Table A'[Order Creation Date], 'Table A'[Ship Date], DAY ) < 0,
-1,
DATEDIFF ( 'Table A'[Order Creation Date], 'Table A'[Ship Date], DAY )
)
)
)- Sri57Frequent Visitor
it is getting error like cannot find name under [Ship Date] and [Order Creation Date] columns when I convert it to measure
- bhelou
Responsive Resident
try this :
Measure =
IF (
ISBLANK('Table A'[Ship Date]) || ISBLANK('Table A'[Order Creation Date]),
BLANK(),
IF (
'Table A'[Ship Date] - 'Table A'[Order Creation Date] < 0,
-1,
'Table A'[Ship Date] - 'Table A'[Order Creation Date]
)
)- Sri57Frequent Visitor
it is getting error like cannot find name under [Ship Date] and [Order Creation Date] columns when I try this
- bhelou
Responsive Resident
Hi , kindly share a sample of the Pbix file
- Sri57Frequent Visitor
bhelou please find the attached sample file in
https://www.dropbox.com/s/tm3orr9kpqvlatt/Test.pbix?dl=0