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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anonymous
Not applicable

Constrain date range in a Measure

I created a measure to replace blanks with '0' in a table, but now I have an issue where the function has inserted zeros for the rest of 2022 year. I'd like to constrain this date up to the current month only. I would appreciate some advice on how to solve this. 

 

brnev1_0-1647302363710.png

 

2 ACCEPTED SOLUTIONS
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

 

vyalanwumsft_0-1647497447126.png

Your parentheses are not in the right place. You are missing ") "where I made up the notes.


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous;

 

Is your problem solved? If so, Would you mind accept the helpful replies as solutions? Then we could close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

Best Regards,
Community Support Team_ Yalan WuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous;

 

Is your problem solved? If so, Would you mind accept the helpful replies as solutions? Then we could close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.

Best Regards,
Community Support Team_ Yalan WuIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

 

vyalanwumsft_0-1647497447126.png

Your parentheses are not in the right place. You are missing ") "where I made up the notes.


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

You could modify measure as follow:

COALESCE = 
IF(MAX('Table'[Date].[Date])<=EOMONTH( MAXX(ALL('Table'),[Date]),0),COALESCE(COUNT('Table'[Date]),0))

The final output is shown below:

vyalanwumsft_0-1647482890973.png

vyalanwumsft_1-1647482901238.png


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@v-yalanwu-msft Thanks. I've tried that, but now I have this error. I've checked the syntax but I don't know what's wrong. 

brnev1_1-1647487693894.png

 

 

VahidDM
Super User
Super User

Hi @Anonymous 

 

Try this:

Var _A = calculate(COUNT(Incident[Date]),filter(Incident,Incident[Date]<=today()))
return

Measure = IF(isblank(_A),0,_A)

 

 

Or set a filter on the filter pane to show filter before today.

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Anonymous
Not applicable

@VahidDM 

I tried that but now I have this error message. Any tips on how to solve this?

brnev1_0-1647478233259.png

 

Hi @Anonymous 

 

Not sure why my formula changed :-D, Try this:

 

Measure =

Var _A = calculate(COUNT(Incident[Date]),filter(Incident,Incident[Date]<=today()))
return

IF(isblank(_A),0,_A)

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors