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
ballist1x
Helper III
Helper III

Create a measure - Date filtering

Hi i am trying to cretae a measure to calculate for example, revenue which is filtered by 2 date ranges, for example

 

NEW Revenue = (Table1[Revenue]), Filtered by Date[Year]<2019 where the revenue is equal to or less than £0 AND Filter by Date[Year]>2020 where the revenue >£0

 

is there a simple way to write this in Dax?

 

 

5 REPLIES 5
PiyushH1
Helper I
Helper I

hello,

 

I am on your query , but can you please explain me more in detail what you are trying to achive ?

I will try to help you.

 

Thank you.

 

Piyush 

 

thnak you, i am trying to work out who are net new customers, i.e those that have not bought certain products before in a set time frame and those who have bought customers this year for example so that we can count the number of them for analysis purposes.

Anonymous
Not applicable

Hi @ballist1x 

 

In your logic you have mentioned year<2019 AND Year>2020.

Please check the above logic this will never evaluate to true for AND condition. May be requirement is OR COndtion.

 

Measure=calculate( Sum(table[revenue]),filter(table, (table[year]<2019 && table[revenue]<0) || (table[year]>2020 && table[revenue]>0) )

 

Thanks

Pravin Wattamwar.

 

if it resolves your problem  mark it as solution and give kudos.

hi thanks, i tried this but got an error:

 

"A function 'FILTER' has been used in a True/False expression that is used as a table filter expression. This is not allowed."

 

 

 

 

Hi @ballist1x ,

 

there is a option  quick new  measue under filter "sales from new customer". please try this. 

 

it should work.

 

if it resolves your problem  mark it as solution and give kudos.

 

Regards,

Piyush

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.

Top Solution Authors