Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
Check it out now!Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
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.