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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
abaak
Frequent Visitor

Measure with contains and starts with

Hi all,

 

I need a measure with a calculation of Revenue with some filters but i am not sure how to do this. I know this is possible in the visual filters, but I need to add another calculation to this one after it that is why I need it in a measure.

 

 

I need the sum from Revenue

Which contains or starts with "BV" from Order

And starts with "PA" from Note

 

I was trying something with CALCULATE(SUM( )) and FILTER and FIND() but obviously not getting the results I want.

Below the sample data, at the end I only need the €61, €23 and €65 below.

 

RevenueOrderNote
 €       123,00BV45GF23
 €          61,00BV46PA143
 €          48,00OR456CD32
 €          65,00OR457PA32
 €          45,00OR458PA124
 €          23,00BV47PA543
 €          65,00BV48PA234
 €          56,00BV48CD42
 €          43,00ORD459RG43
 €          23,00OR460RG34
 €          43,00BV46CD52

 

Thanks in advance!

1 ACCEPTED SOLUTION
iamprajot
Responsive Resident
Responsive Resident

Here it is,

CALCULATE(AVERAGE(TableName[Revenue]),FILTER(TableName,LEFT(TableName[Order],2)="BV" && LEFT(TableName[Note],2)="PA"))

View solution in original post

5 REPLIES 5
iamprajot
Responsive Resident
Responsive Resident

Here it is,

CALCULATE(AVERAGE(TableName[Revenue]),FILTER(TableName,LEFT(TableName[Order],2)="BV" && LEFT(TableName[Note],2)="PA"))

Thanks alot! I was actually pretty close! 

iamprajot
Responsive Resident
Responsive Resident

Sure.
The solution provided earlier was if BV and PA are at starting position and here is another one if they fall between the text.
CALCULATE(AVERAGE(TableName[Revenue]),FILTER(TableName,FIND("BV",TableName[Column 1],1,0) > 0 && FIND("PA",TableName[Column 1],1,0) > 0))
check the brackets if i missed any at closing and hit some kudos if this worked and helped.
Thanks
Greg_Deckler
Super User
Super User

Sample data please.

 

Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Done! hopefully this makes it more clear.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.