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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
mekaelj
Helper II
Helper II

Filter sales by price under specific amount

 Hi,

 

I have a table where I have all my sales data. I then have another table with price floors for my different products. I want to create measures where I filter out only sales under and over the floor price respectively. How would I go about doing this?

 

Regards,

12 REPLIES 12
vanessafvg
Super User
Super User

@mekaelj are these tables related at all?  

 

easy to do when you have a relationship, 

 

over floor price = calculate(sum(saleamount), saleamount> flooramount)

 

etc





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Hi,

 

Thanks for your reply!

 

They are related. I think what complicates it a little bit is that I calculate the sales amount from two different tables where I have the sales price in one column and then rebates in another. My sales amount calculation looks like this:

 

Sales in $ = SUM(Sales Table[Gross Sales]) - SUM(Sales Table[Discounts])

 

The command you gave me doesn't work for measures from what I can tell, is there a way around this?

 

Regards,

@mekaelj you can always create a calculated column instead of a measure





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Hi,

 

Just did! Still can't get it to work though. 

 

Using the following formula:

 

Sales under floor = CALCULATE(SUM(Sales[Sales]);Sales[sales]>Floortable[Floor])

 

I get this error:

 

The expression contains multiple columns, but only a single column can be used in a True/False expression that is used as a table filter expression.

 

Regards,

@mekaelj,

 

You may use RELATED Function or LOOKUPVALUE Function to filter data.

Table =
FILTER ( Sales, Sales[Sales] > RELATED ( Floortable[Floor] ) )
Table =
FILTER (
    Sales,
    Sales[Sales]
        > LOOKUPVALUE ( Floortable[Floor], Floortable[Product], Sales[Product] )
)
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.

Hi,

 

 

I'm not quite sure how to use this. When I try it as a measure I get 

"The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value." as an error and I don't understand how I'd go about creating a table for it.

 

Regards,

@mekaelj,

 

Add a measure as shown below.

Measure =
SUMX (
    FILTER ( Sales, Sales[Sales] > RELATED ( Floortable[Floor] ) ),
    Sales[Sales]
)
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.
Anonymous
Not applicable

@mekaelj

 

Did you solve your issues?

Anonymous
Not applicable

Hi @mekaelj

 

 

Try this: Sales under floor = CALCULATE(SUM(Sales[Sales]);SUM(Sales[sales])>SUM(Floortable[Floor]))

 

Let us know, if it works.

 

Best

Martin

Hi,

 

That yields the following response:

 

Too many arguments were passed to the SUM function. The maximum argument count for the function is 1.

 

Regards,

@mekaelj the best idea might be to actually add the related field (floor to the table) and then do the calculation

 

does that make sense?

 

so 1. add new calculated column floor to table

then do calculation

 

probably is that the grain is different so it doesn't know which one to choose, maybe if you played with the max function it might help.  





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Hi,

 

I understand what you mean, but I don't know how to actually do it. 

 

In my sales query I have like 4.000.000 lines of sales. I assume I'd have to add the floor price to each of these sales? How would I go about doing this? I havenät found a way to create a conditional column between querys.

 

Regards,

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!

December 2024

A Year in Review - December 2024

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