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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
rderrickwhite
Helper I
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:

 

SHIPMENTS OUT.PNG

 

 

 

 

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.

 

Link to project mockup:

 

https://1drv.ms/u/s!Ar8mMAEgH9mzaiaJKQo9b7ZOR1I 

 

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

2 ACCEPTED SOLUTIONS
camargos88
Community Champion
Community Champion

@rderrickwhite ,

 

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]))

 

Did I answer your question? Mark my post as a solution!
Ricardo

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

@camargos88 

 

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]))

View solution in original post

2 REPLIES 2
camargos88
Community Champion
Community Champion

@rderrickwhite ,

 

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]))

 

Did I answer your question? Mark my post as a solution!
Ricardo

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



@camargos88 

 

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]))

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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

Top Solution Authors