Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I'm counting picks in the warehouse in the last hour and measuring against targets. Everything works fine except that when there are 0 lines picked the target number turns blank.
I am using one "Targets" fromula for all of my gauges and filtering each gauge to one zone of the warehouse e.g. HRZU and VLM. Using SELECTEDVALUE shows the correct target number for the selected zone. It all works great until there are 0 picks. How do I get that target number to stay despite 0 picks?
Here is the formula that I'm using:
Solved! Go to Solution.
I'm thinking it's caused by the MAX ( 'Current Date Time'[Time] ) returning BLANK. Maybe try it like this (I reorganized the switches a bit to make it easier for me to understand). The _Time VAR give a 0 if the MAX ( 'Current Date Time'[Time] ) is BLANK.
Targets =
// Targets for all zones, the target depends on the zone filter of the visual and the time of day. The time of day is 2.75 which is 1/1/1900 18:00.
VAR _Selection =
SELECTEDVALUE ( 'Order Picks'[Zone ID] )
VAR _MaxTime =
MAX ( 'Current Date Time'[Time] )
VAR _Time =
IF ( ISBLANK ( _MaxTime ), 0, _MaxTime )
RETURN
SWITCH (
TRUE (),
_Time < 2.75,
SWITCH (
_Selection,
"CFLO2", 34,
"CFLOW", 75,
"CSGDS", 45,
"HRZL", 60,
"HRZU", 54,
"VLM", 44
),
_Time >= 2.75,
SWITCH (
_Selection,
"CFLO2", 24,
"CFLOW", 25,
"CSGDS", 13,
"HRZL", 31,
"HRZU", 28,
"VLM", 16
)
)
I'm thinking it's caused by the MAX ( 'Current Date Time'[Time] ) returning BLANK. Maybe try it like this (I reorganized the switches a bit to make it easier for me to understand). The _Time VAR give a 0 if the MAX ( 'Current Date Time'[Time] ) is BLANK.
Targets =
// Targets for all zones, the target depends on the zone filter of the visual and the time of day. The time of day is 2.75 which is 1/1/1900 18:00.
VAR _Selection =
SELECTEDVALUE ( 'Order Picks'[Zone ID] )
VAR _MaxTime =
MAX ( 'Current Date Time'[Time] )
VAR _Time =
IF ( ISBLANK ( _MaxTime ), 0, _MaxTime )
RETURN
SWITCH (
TRUE (),
_Time < 2.75,
SWITCH (
_Selection,
"CFLO2", 34,
"CFLOW", 75,
"CSGDS", 45,
"HRZL", 60,
"HRZU", 54,
"VLM", 44
),
_Time >= 2.75,
SWITCH (
_Selection,
"CFLO2", 24,
"CFLOW", 25,
"CSGDS", 13,
"HRZL", 31,
"HRZU", 28,
"VLM", 16
)
)
Not sure this is what you mean, but you can use the optional alternateresult term of SELECTEDVALUE to have a default value when nothing is selected from the slicer
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@jdbuchanan71 @mahoneypat Thanks I reorganized the switches as well. The issue here is that I'm counting picks in the warehouse in the last hour, sometimes there were 0 picks in a certain zone and SELECTEDVALUE doesn't work because there is nothing to select (despite a filter on the visual for a that zone). @mahoneypat I made one big formula for all the zones so the alternate result is not an option here because I would want a different number based on each zone.
Is there a work around for this issue?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
100 | |
80 | |
64 | |
57 |
User | Count |
---|---|
146 | |
110 | |
93 | |
84 | |
67 |