cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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

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

@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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors