Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi @sarahomar955 ,
Please try:
Total_Customers_2 =
VAR Base = [notselected_customers] + [AllActuals]
VAR SelectedLine =
SELECTEDVALUE ( 'SBI Actuals Agg (x100)'[Line of Items] )
VAR Result =
SWITCH (
SelectedLine,
"[NE]", CALCULATE ( [Nes_time_new] + Base ),
"[L66]", CALCULATE ( [L6_time_new] + Base ),
"[L66b]", CALCULATE ( [L6b_time_new] + Base ),
"[C11]", CALCULATE ( [c1_time_new] + Base ),
"[L110]", CALCULATE ( [L10_time_new] + Base ),
{ [GE], "[L66a]", "[L1]", "[L2]", "[L3]", "[Net Weight]" }, [Fixed_Date_Total_Customers] + [AllActuals],
"[L14]", CALCULATE ( [L14_time_new] + Base ),
"C1", [c1PerNes_total]
)
VAR NumericValue =
IF ( ISNUMBER ( Result ), Result, [Fixed_Date_Total_Customers] + [AllActuals] )
RETURN
FORMAT ( NumericValue, "#,##0" )
Optimizing IF conditions by using variables - SQLBI
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Use DAX Studio to examine the query plan for that query and then see if you can refactor it.
Note that "SELECTEDVALUE" needs to be complemented with TREATAS filters.
User | Count |
---|---|
16 | |
14 | |
13 | |
12 | |
11 |
User | Count |
---|---|
19 | |
15 | |
15 | |
11 | |
10 |