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
Anonymous
Not applicable

Error when filtering measure by 2 columns

The measure I am trying to display is a sales measure and I want to filter by a range of order dates within the last 2 weeks and one brand. I could filter the sales by either one individually and the mesasure would display just fine, but then when I try to filter the measure by both of them using multiple filter conditions, the chart doesn't display and I get this message: "The expressin contains multiple columns but only a single column can be used in a True/False expression that is used as a table filter expression."

 

I tried two different formulas:

 

calculate(sales, 'brand'[brand] =  "brand1" || 'order date'[order date] >= today()-14)

 

and

 

sumx(filter('brand'[brand] = "brand1") && filter('order date'[order date] >= today()-14), sales)

 

 

Same error both ways. Can anyone help me out with what theproblem is and how to work around it?

 

 

Note: The sales measure is calculated in the Azure Analysis Services layer.

 

 

UPDATE: I changed the calculate formula to:

 

calculate(sales, 'brand'[brand] =  "brand1", 'order date'[order date] >= today()-14)

 

Now the chart displays but I am getting a constant value, which is not what I am looking for.

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

Suppose there existing reationship between 'brand'and 'order date'. Please try this:

Formula =
CALCULATE (
    [sales],
    FILTER (
        'brand',
        'brand'[brand] = "brand1"
            && RELATED ( 'order date'[order date] )
                >= TODAY () - 14
    )
)

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
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

1 REPLY 1
v-yulgu-msft
Employee
Employee

Hi @Anonymous,

 

Suppose there existing reationship between 'brand'and 'order date'. Please try this:

Formula =
CALCULATE (
    [sales],
    FILTER (
        'brand',
        'brand'[brand] = "brand1"
            && RELATED ( 'order date'[order date] )
                >= TODAY () - 14
    )
)

Best regards,

Yuliana Gu

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

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