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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
JorisVoorn
Employee
Employee

COMPARE X

Hi guys,

 

I am looking for something like COMPAREX statement.

 

Imagine that I have two tables.

 

Table one contains sales data per day and identificator and products, Table to Contains identificator (relationship between these two tables is established byse on it) and treshold.

 

What I need to create is measure where is if statement:

 

if treshold >= sum of sales then SUMX

 

This is easy in terms of selection only one product but in case I select more products then the evalution will bring the incorrect results as the if statement will be like that:

 

if (treshold 1 + treshold 2) >= (sum of sales 1 + sum of sales 2) then SUMX

 

However I would need something like this:

 

if  (treshold 1 >= sum of sales 1) then SUMX1 + (treshold 2>=sum of sales 2) then SUMX2

 

But imagine that there is bung of products so not possible to hard code it like this.

 

Any ideas?

 

Thanks in advance

1 REPLY 1
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @JorisVoorn,

 

If you want to use DAX, you may use if function like below.

 

if(expression1>expression2,true result,false result, if(...),...,...)

If you want to use Power Query, you could have a reference of this blog.

 

If you need further help, please share some data sample and your desired output.

 

Best Regards,

Cherry

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.