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

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.

Reply
ChoiJunghoon
Helper III
Helper III

[DAX] create measure value that it doesn't has null value in the column?

Hello. 

How to calculate like below it ?  

Untitled2.png

Min = CALCULATE(MIN('Table'[CompletedDate]),FIlter('Table','Table'[CompletedDate]<>blank()))
2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Add another column called "complete" add measure complete =if(isblank(completed date),1,0) 

 

then create a measure like this 

 

if(calculate(sum([complete]),filter([table name],[ID] = [ID])> 0, "incompleted" , calculate(min(date),filter(table name],[ID] = [ID]))

View solution in original post

@ChoiJunghoon 

 

Try this DAX measure.

 

MinCompleteDate = 
VAR __result =
    IF (
        BLANK () IN VALUES ( 'Table'[CompletedDate] ),
        "",
        MIN ( 'Table'[CompletedDate] )
    )
RETURN
    __result

 

nandukrishnavs_0-1597725592153.png

 

Please check the attached pbix file.



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂

 


Regards,
Nandu Krishna

View solution in original post

11 REPLIES 11
pranit828
Community Champion
Community Champion

Hi @ChoiJunghoon 

 

Use the below measure

VAR Min_dt = FORMAT(MINX('Table',DATEVALUE(IF('Table'[CompletedDate]="","1947-08-15",'Table'[CompletedDate]))),"YYYY-MM-DD")
RETURN IF(Min_dt = "1947-08-15","",Min_dt)

 I created this measure and used it in a matrix chart, Here is the o/p.

pranit828_0-1597721057931.png

for I/P

pranit828_1-1597721085340.png

 

 

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile
amitchandak
Super User
Super User

@ChoiJunghoon , based on Num column, Create a measure and use this with ID

lastnonblankvalue(Table[Num], Min(Table[Completed Date]))

 

 

 Sorry, your Dax is 

IDMeasure
A2020-08-10
B2020-07-31
C 
D2020-0803

 

I want that A is display with "Null"....

Because A has Null in table[CompleteDate] 

 

@ChoiJunghoon , Try this

Measure =
VAR __id = MAX ( 'Table'[ID] )
VAR __date = CALCULATE ( MAX( 'Table'[NUM] ), ALLSELECTED ( 'Table' ), 'Table'[ID] = __id )
CALCULATE ( Min ( 'Table'[Date] ), VALUES ( 'Table'[ID ), 'Table'[ID] = __id, 'Table'[NUM] = __date )

Thank you for your reply. 

My question is, if there is no date value, then that id completed date is null,

and if that id has all date values, i want to load the min completed date among them.

 

Sorry for your confuse. 

@ChoiJunghoon , Can you share sample data and sample output in table format?

Hi, i don't know how to attached file at this..

IDUnitCompletedDate
A12020/8/10
A2
A32020/8/1
B32020/7/31
B42020/7/28
B52020/7/29
B62020/7/27
C1
C3
D12020/8/2
D22020/8/1
D42020/8/3
E12020/8/15
E5
F12020/8/16
F22020/8/15

Create meaure

TableMin CompletedDate
A
B2020-07-27
C
D2020-08-01
E
F2020-08-15

Example ) A is null, becuase A has null value at completed date column.

B is "2020/7/27", Because B has all value at complted date column.

@ChoiJunghoon 

 

Try this DAX measure.

 

MinCompleteDate = 
VAR __result =
    IF (
        BLANK () IN VALUES ( 'Table'[CompletedDate] ),
        "",
        MIN ( 'Table'[CompletedDate] )
    )
RETURN
    __result

 

nandukrishnavs_0-1597725592153.png

 

Please check the attached pbix file.



Did I answer your question? Mark my post as a solution!
Appreciate with a kudos
🙂

 


Regards,
Nandu Krishna

Anonymous
Not applicable

Add another column called "complete" add measure complete =if(isblank(completed date),1,0) 

 

then create a measure like this 

 

if(calculate(sum([complete]),filter([table name],[ID] = [ID])> 0, "incompleted" , calculate(min(date),filter(table name],[ID] = [ID]))

@ChoiJunghoon  use this one.

MinCompletedDate =
IF(
COUNTBLANK('Table'[CompletedDate]) > 0,
BLANK(),
MIN('Table'[CompletedDate])
)
 
Edit: I am adding some explanation. In Microsoft Documentation, MIN is counting BLANK values as 0 and will be included. When I test date with string values, MIN is taking count BLANK values and works. When it changes to date data type, then MIN no longer counts BLANK. I think your scenario is as belows: IF MIN(values) HAS BLANK THEN BLANK ELSE MIN(values).

Hi @ChoiJunghoon 

Here you go, exactly as per the input you have shared.

 

Measure =
VAR Min_dt = FORMAT(MINX('Table',DATEVALUE(IF('Table'[CompletedDate]="","1947-08-15",'Table'[CompletedDate]))),"YYYY-MM-DD")
RETURN IF(Min_dt = "1947-08-15","",Min_dt)

 

 Input and Output as needed.

pranit828_0-1597723307266.png

 





PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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