https://docs.microsoft.com/en-us/power-bi/guidance/whitepaper-powerbi-security
Monday, August 31, 2020
Wednesday, August 26, 2020
Power BI - How to Set a Default Slicer Value (8:49)
https://www.youtube.com/watch?v=pCgK-Ze3nhA
Date example - add a DateRange calculated column with this DAX:
DateRange = IF(MONTH(Date[Date]) = MONTH(TODAY()) && YEAR(Date[Date]) = YEAR(TODAY()), "Current Month", MONTH(TODAY()) - MONTH(Date[Date]) & " Months ago")
Tuesday, August 25, 2020
Select Measure to Render Based on Rows
-- create a datatable to populate the rows of a matrix
Metric Slicer =
DATATABLE("Metric", STRING,
{
{ "Units" },
{ "Gross $" }
}
)
-- create a measure to return the correct measure based on the row in a matrix
Loan Metric Selector =
SWITCH(
SELECTEDVALUE(
'Metric Slicer'[Metric]
),
"Units", [Loans Closed Count],
"Gross $", [Total Loan Amount]
)
Total Quantity on Weekdays
Total Quantity (Weekday) =
CALCULATE(
[Total Quantity],
FILTER(
'Internet Sales',
RELATED('Date'[DayNumberOfWeek]) > 1 &&
RELATED('Date'[DayNumberOfWeek]) < 7))
-- filter on the one side of the relationship
Total Quantity (Weekday) =
CALCULATE(
[Total Quantity],
FILTER(
'Date',
AND('Date'[DayNumberOfWeek] > 1,
'Date'[DayNumberOfWeek] < 7)))
7 Day Moving Average
Sales 7-Day Moving Average =
VAR StartDate = DATEADD(LASTDATE('Date'[Date]), -6, DAY)
VAR EndDate = LASTDATE('Date'[Date])
RETURN
AVERAGEX(
DATESBETWEEN(
'Date'[Date],
StartDate,
EndDate),
[Total Sales])
Use CONCATENATEX for Debugging
3 Month Sales Rolling Average (ConcatenateX) =
VAR EndDate = LASTDATE('Date'[Date])
RETURN
CALCULATE(
CONCATENATEX(
VALUES('Date'[MonthNumberOfYear]),
'Date'[MonthNumberOfYear], ", ", 'Date'[MonthNumberOfYear]),
DATESINPERIOD(
'Date'[Date],
EndDate,
-3,
MONTH))
Total Sales All Time (remove blanks)
Total Sales (All Time) =
IF(
[Total Sales] = BLANK(),
BLANK(),
CALCULATE(
[Total Sales],
ALL('Date'[CalendarYear] ) ) )
3 Month Rolling Average
3 Month Sales Rolling Average (Values) =
VAR EndDate = LASTDATE('Date'[Date])
RETURN
CALCULATE(
CONCATENATEX(
VALUES('Date'[MonthNumberOfYear]),
'Date'[MonthNumberOfYear], ", "), //[Total Sales]),
DATESINPERIOD(
'Date'[Date],
EndDate,
-3,
MONTH))
Rolling 12 Months Profit
Rolling 12 Months Profit =
VAR StartDate = NEXTDAY(SAMEPERIODLASTYEAR(LASTDATE('Date'[Date])))
VAR EndDate = LASTDATE('Date'[Date])
RETURN
CALCULATE(
[Profit],
DATESBETWEEN(
'Date'[Date],
StartDate,
EndDate))
Monday, August 17, 2020
Wednesday, August 12, 2020
Subscribe to:
Comments (Atom)