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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
AgencyPowerBi
Helper III
Helper III

IN Operator, array in field value

Hi,

 

I want to do a conditional sum by using IN operator.

I have clients for which I calculate the sum investments depending on the period and type of investments.

So for instance, 

 

Client A

active from 1.1. 2018

Active to 31.1.2018

Media PRINT, TV, OOH

 

These would be stored in 4 columns of a table

 

Client | AcitveF | ActiveT | Media

text | date | date | text

 

So, is it possible and how to caluculate sum in a way

 

calculate (sum [Cost]; start date > [activef] && end date < [activet] && media IN [Media]

 

last part is making me problems since IN operator wants an array.

Can I make one from a text field?

 

Tx 

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@AgencyPowerBi,

 

Instead, you may try SUBSTITUTE Function and PATHCONTAINS Function.

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

So something like:

 

calculate (sum [Cost]; start date > [activef] && end date < [activet] && pathcontains([media]; media) ?

 

tx,

Ante

Tried it, dodnt work.

I'm including excel in which Im trying to implement this measure.

Advertiser sheet is data for advertisers: Name of advertiser, and list of media it is active in.

Cost is just advertisers, media and cost columns.

What I want is to calculate the cost if media in Cost table coresponds to list of media for the advertiser.

 

Excel file

Helpful resources

Announcements
Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.