Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Sri57
Frequent Visitor

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

1 ACCEPTED SOLUTION
Dangar332
Super User
Super User

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 )
)
)
)

View solution in original post

7 REPLIES 7
Dangar332
Super User
Super User

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 )
)
)
)
bhelou
Responsive Resident
Responsive Resident

Hi , kindly share a sample of the Pbix file 

Sri57
Frequent Visitor

@bhelou  please find the attached sample file in 
https://www.dropbox.com/s/tm3orr9kpqvlatt/Test.pbix?dl=0

bhelou
Responsive Resident
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]
)
)

Sri57
Frequent Visitor

it is getting error like cannot find name under [Ship Date] and [Order Creation Date] columns when I try this

some_bih
Super User
Super User

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 )
)
)
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






it is getting error like cannot find name under [Ship Date] and [Order Creation Date] columns when I convert it to measure

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.