cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
netanel
Super User
Super User

If the cell is empty then insert "-"

Hey All!

 

I try to include in my Measure the condition that if the cell is empty
Then replace with "-" 
Can help?

 

Net USD AVG =

VAR NumDays=
CALCULATE (
DISTINCTCOUNT ('DB 2022'[Date] ),
KEEPFILTERS( 'Date'[Date] < TODAY() ),
NOT ISBLANK ( 'DB 2022'[Net USD]),
REMOVEFILTERS ( 'SORT GL' )
)

VAR SumNet =
CALCULATE (
SUM ( 'DB 2022'[Net USD]),
KEEPFILTERS( 'Date'[Date] < TODAY() )
)

RETURN DIVIDE (SumNet, NumDays)







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

Connect on Linkedin
linkedin.com/in/netanel-shriki
1 ACCEPTED SOLUTION
CNENFRNL
Super User
Super User

Go on with VAR,

...
VAR RES = DIVIDE (SumNet, NumDays)
RETURN IF( ISBLANK(RES), "-", RES )

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

4 REPLIES 4
CNENFRNL
Super User
Super User

Go on with VAR,

...
VAR RES = DIVIDE (SumNet, NumDays)
RETURN IF( ISBLANK(RES), "-", RES )

Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is beyond their comprehension!

DAX is simple, but NOT EASY!

VijayP
Super User
Super User

@netanel  try this

VAR NumDays=
IF(ISBLANK(DISTINCTCOUNT ('DB 2022'[Date] ),"-",
CALCULATE
 (
DISTINCTCOUNT ('DB 2022'[Date] ),
KEEPFILTERS'Date'[Date] < TODAY() ),
NOT ISBLANK ( 'DB 2022'[Net USD]),
REMOVEFILTERS ( 'SORT GL' )
)
 
and also in divide function use this and see whether you are getting final out come
if in the place of denominator if you get "-" , then accordingly rest of the measure will take care

RETURN DIVIDE (SumNetNumDays,"-"




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


VijayP
Super User
Super User

@netanel 

if(isblank(measure/column),"-",required Dax) hope this helps!




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


@VijayP 

Of course I tried if isblank
But I can not incorporate this correctly in my Measure








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

Connect on Linkedin
linkedin.com/in/netanel-shriki

Helpful resources

Announcements
September Update

Check it Out!

Click here to learn more about the September 2022 updates!

Power BI Dev Camp Session 26

Check it Out!

Mark your calendars and join us on Thursday, September 29 at 11a PDT for a great session with Ted Pattison!

Top Solution Authors