cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper I

## Creating Conditional Measurements

I have a simple measure that is as follows:

AVG QTY PRODUCED = COUNT('SHIPMENTS OUT'[ORDER_NO])/SUM('CALENDAR'[DAYS WORKED 5 DAY])

What I need to accomplish is to make this measure conditional, based on the site:

If the Site equals 21201, then the formula should be:

AVG QTY PRODUCED = COUNT('SHIPMENTS OUT'[ORDER_NO])/SUM('CALENDAR'[DAYS WORKED 4 DAY])

Otherwise, it should be:

AVG QTY PRODUCED = COUNT('SHIPMENTS OUT'[ORDER_NO])/SUM('CALENDAR'[DAYS WORKED 5 DAY])

There is a need to look at the information as a whole, and separately, so I don't think separate measures will work.

This has been keeping me up at night.  Any help is appreciated.

2 ACCEPTED SOLUTIONS
Community Champion

Have you tried hard code on it?

AVG QTY PRODUCED =

VAR _site = SELECTEDVALUE(TABLE[SITE])

RETURN

IF _site = 21201;

COUNT('SHIPMENTS OUT'[ORDER_NO])/SUM('CALENDAR'[DAYS WORKED 4 DAY]);

AVG QTY PRODUCED = COUNT('SHIPMENTS OUT'[ORDER_NO])/SUM('CALENDAR'[DAYS WORKED 5 DAY]))

Ricardo

Proud to be a Super User!

Helper I

That's a good idea.  This is what worked.

AVG QTY PRODUCED =
VAR _site = SELECTEDVALUE('SHIPMENTS OUT'[SITE])
RETURN
IF(_site = 21201,
COUNT('SHIPMENTS OUT'[ORDER_NO])/SUM('CALENDAR'[DAYS WORKED 4 DAY]),
COUNT('SHIPMENTS OUT'[ORDER_NO])/SUM('CALENDAR'[DAYS WORKED 5 DAY]))
2 REPLIES 2
Community Champion

Have you tried hard code on it?

AVG QTY PRODUCED =

VAR _site = SELECTEDVALUE(TABLE[SITE])

RETURN

IF _site = 21201;

COUNT('SHIPMENTS OUT'[ORDER_NO])/SUM('CALENDAR'[DAYS WORKED 4 DAY]);

AVG QTY PRODUCED = COUNT('SHIPMENTS OUT'[ORDER_NO])/SUM('CALENDAR'[DAYS WORKED 5 DAY]))

Ricardo

Proud to be a Super User!

Helper I

That's a good idea.  This is what worked.

AVG QTY PRODUCED =
VAR _site = SELECTEDVALUE('SHIPMENTS OUT'[SITE])
RETURN
IF(_site = 21201,
COUNT('SHIPMENTS OUT'[ORDER_NO])/SUM('CALENDAR'[DAYS WORKED 4 DAY]),
COUNT('SHIPMENTS OUT'[ORDER_NO])/SUM('CALENDAR'[DAYS WORKED 5 DAY]))

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors