DAX Cookbook
HTML only when one item is selected
Text (HTML) =
VAR one = HASONEVALUE(table[itemid])
VAR _html = SUBSTITUTE(
CONCATENATEX(
table,
"<p><b>" & [subject] & "</b></p>"
& "<p>" & [description] & "</p>"
),
UNICHAR(10),
"<br>"
)
RETURN IF(
one,
_html,
""
)
Cumulative count up to start of month
Cumulative Volume to Beginning of Month =
VAR _startOfMonth = STARTOFMONTH('calendar'[Date])
VAR _thisDate = LASTNONBLANK('calendar'[Date], [Date])
RETURN
CALCULATE(
[Measure],
FILTER(
ALL('calendar'),
[Date] >= _startOfMonth
&& [Date] <= _thisDate
)
)
NULLIF()
This is a user-defined function.
NULLIF = ( thisvalue, nullvalue ) =>
IF(
thisvalue = nullvalue,
BLANK(),
thisvalue
)
A common one would be to force zeroes to be blanks/nulls:
NULLIF(thisvalue, 0)