.Class =
SWITCH (
TRUE ();
ISERROR ( FIND ( "2021"; DIM_directoriesW[FolderFirst2] ) ) <> TRUE (); "Online";
ISERROR ( FIND ( "2018"; DIM_directoriesW[FolderFirst2] ) ) <> TRUE (); "Legacy";
ISERROR ( FIND ( "2019"; DIM_directoriesW[FolderFirst2] ) ) <> TRUE (); "Legacy";
ISERROR ( FIND ( "2020"; DIM_directoriesW[FolderFirst2] ) ) <> TRUE (); "Legacy";
ISERROR ( FIND ( "..."; DIM_directoriesW[FolderFirst2]) ) = TRUE ()
&& ISERROR ( FIND ( "BAG"; DIM_directoriesW[FolderFirst2] ) ) = TRUE (); "???"
)
Case1 = IF(
SELECTEDVALUE(DimCustomer[EnglishEducation])="Bachelors",
"Green",
"White")
Case2 =
SWITCH(
SELECTEDVALUE(DimCustomer[EnglishEducation]),
"Bachelors","Green",
"High School","Red",
"Partial High School","Tan",
"Graduate Degree","Yellow",
"White"
)
IF (
[A] > [B],
"First case",
IF (
[A] = [B],
"Second case",
IF (
[A] = 0,
"Third case",
"Fourth case"
)
)
)
Case3 =
SWITCH(
TRUE(),
[Sales]>8000000,"Green",
[Sales]>5000000,"Tan",
[Sales]>3000000,"Yellow",
[Sales]<2000000,"Red",
"White"
)
-- Using SWITCH the first condition met defines the result.
-- In the following example, the second condition (<= 150) will never be
-- met, because the first one is less restrictive.
DEFINE MEASURE Sales[Discounted Sales] =
SUMX (
SUMMARIZE ( Sales, Sales[Net Price], Product[Category] ),
VAR DiscountPct =
SWITCH (
TRUE,
Sales[Net Price] <= 1000, 0.2,
Sales[Net Price] <= 150, 0.15,
Product[Category] = "Audio", 0.13,
0
)
RETURN
[Sales Amount] * (1 - DiscountPct )
)
EVALUATE
SUMMARIZECOLUMNS (
'Product'[Category],
"Sales Amount", [Sales Amount],
"Discounted sales", [Discounted Sales]
)
ORDER BY [Category]
Subscribe to:
Post Comments (Atom)
Power BI APP - Delete or Unpublish
UNPUBLISH DELETE
-
There are two points to be evaluated: 1. If you want to discard the errors In this case, just run: #"Removed errors" = Table.Re...
-
====================================================== CSV: let Source = SharePoint.Files("https://site", [ApiVersion = 15]), ...
-
Code for creating a table Dim_Calendar Refresh Path let Source = "C:\Temp\datasets\board\csv\__20200210_120926_.ARCHIVE" ...
No comments:
Post a Comment