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

Divide function using filtered data

Hey All,

 

Looking to get a divide of the below data.

AdamRatcliff_0-1611834785056.png

On the first metro line i need to get a new measure that would divide the metro that has a blank floor display entry against the on that has "floor display" next to it.

 

So 534 / 13 really. I have tried using a calculation and various bits to filter the data but cant get the answer im after.

 

The count of Customer Ref is a distict count as well.

 

Thanks,

Adam

5 REPLIES 5
Anonymous
Not applicable

Hi @amitchandak,

 

I get the following error - 

AdamRatcliff_0-1611836058128.png

 

Here is my measure.

 

Measure = DIVIDE(
CALCULATE(
SUM('Sales Orders Items'[Customer Ref Copy]),
FILTER('Sales Orders Items',ISBLANK('Sales Orders Items'[Floor Display]))),


CALCULATE(
SUM(
'Sales Orders Items'[Customer Ref Copy]),
FILTER('Sales Orders Items','Sales Orders Items'[Floor Display] = "Floor Display")))

Hi @Anonymous 

Your measure will return error, if you use sum function to summarize the text type column "Customer Ref Copy".

1.png

You can try distinctcount function to caluclate the distinct count of Customer Ref Copy.

My measure:

Measure = 
VAR _MetroFloorDisplay =
CALCULATE(
DISTINCTCOUNT('Sales Orders Items'[Customer Ref Copy]),
FILTER(ALL('Sales Orders Items'),MAX('Sales Orders Items'[Model])="Metro"&&'Sales Orders Items'[Floor Display] = "Floor Display"))
RETURN
IF(
    MAX('Sales Orders Items'[Model])="Metro"
    &&
    ISBLANK(MAX('Sales Orders Items'[Floor Display])
   ),
    DIVIDE(
    DISTINCTCOUNT('Sales Orders Items'[Customer Ref Copy]),
    _MetroFloorDisplay
   )
)

Result is as below.

1.png

534/13 = 41.08

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

Anonymous
Not applicable

This wasn't solved by that solution im afraid. 

 

Unsure why it has been marked as solved?

amitchandak
Super User
Super User

@Anonymous , Please try a measure like

 

divide(calculate(sum(Table[Ref Copy]), filter(Table, isblank(Table[floor display]))),calculate(sum(Table[Ref Copy]), filter(Table, Table[floor display] ="floor display")))

Anonymous
Not applicable

Hi @amitchandak,

 

I get the following error - 

 

 

Here is my measure.

 

Measure = DIVIDE(
CALCULATE(
SUM('Sales Orders Items'[Customer Ref Copy]),
FILTER('Sales Orders Items',ISBLANK('Sales Orders Items'[Floor Display]))),


CALCULATE(
SUM(
'Sales Orders Items'[Customer Ref Copy]),
FILTER('Sales Orders Items','Sales Orders Items'[Floor Display] = "Floor Display")))

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.