Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 |
---|---|
23 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |