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.
I have a table that should provide a row per calendar day and is refreshed several times a day. The data is the current stock level of a warehouse. Based on the data, two measures make a simple 7-day simulation of expected warehouse space. The calculation is cumulative and quite straightforward and the main measure is below.
Occasionally there isn't a row for "NetOfDeliveryCollection" on a calendar day so the simulation goes awry. I think I just need to add a value of zero for that missing day but my quesiton is how? Should I create a fake row in the dataload script or just add an IF condition in the DAX.
Either method, I don't know how to do this!
Measure = SUM(DailyBalances[CurrBalance])
+ CALCULATE(
SUM(Delivery[NetOfDeliveryCollection])
, FILTER(
ALLSELECTED(Delivery)
,Delivery[DelDate] <= MAX(Delivery[DelDate])
)
)
Solved! Go to Solution.
Hi, @PauSe
You can add IF conditions to the DAX. This is shown below.
Measure =
VAR N1 =
SUM ( DailyBalances[CurrBalance] )
+ CALCULATE (
SUM ( Delivery[NetOfDeliveryCollection] ),
FILTER (
ALLSELECTED ( Delivery ),
Delivery[DelDate] <= MAX ( Delivery[DelDate] )
)
)
VAR N2 =
SUM ( DailyBalances[CurrBalance] ) + 0
RETURN
IF ( SELECTEDVALUE ( Delivery[NetOfDeliveryCollection] ) = BLANK (), N2, N1 )
Please try this formula, does this match your desired result?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @PauSe
You can add IF conditions to the DAX. This is shown below.
Measure =
VAR N1 =
SUM ( DailyBalances[CurrBalance] )
+ CALCULATE (
SUM ( Delivery[NetOfDeliveryCollection] ),
FILTER (
ALLSELECTED ( Delivery ),
Delivery[DelDate] <= MAX ( Delivery[DelDate] )
)
)
VAR N2 =
SUM ( DailyBalances[CurrBalance] ) + 0
RETURN
IF ( SELECTEDVALUE ( Delivery[NetOfDeliveryCollection] ) = BLANK (), N2, N1 )
Please try this formula, does this match your desired result?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks, this answered my question of how to add an IF into a DAX. For the record, your formula didnt solve my problem but you have answered my question.
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 | |
99 | |
82 | |
70 | |
63 |
User | Count |
---|---|
145 | |
111 | |
104 | |
84 | |
64 |