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
netanel
Post Prodigy
Post Prodigy

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
Community Champion
Community Champion

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 still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

4 REPLIES 4
CNENFRNL
Community Champion
Community Champion

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 still way 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
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.