[英]Removing Blank Days from Power BI Chart
I have created a weekly request measure like so:我创建了一个每周请求度量,如下所示:
RequestsWeekly = var result= CALCULATE(
DISTINCTCOUNTNOBLANK(SessionRequests[RequestDateTime]),
FILTER('Date','Date'[WeekDate]=SELECTEDVALUE('DateSelector'[WeekDate],MAX('DateSelector'[WeekDate]))))+0
RETURN
IF ( NOT ISBLANK ( result ), result)
DateSelector is a standalone table (not connected to any other table in data model) that I have created for all the dates for a dropdown menu select for a Power BI Dasbboard. DateSelector 是一个独立的表(未连接到数据模型中的任何其他表),我为 Power BI Dasbboard 的下拉菜单选择的所有日期创建了它。 Unfortunately as there are less dates in the Date Selector table than the Date table, I get... Date table is the standard DATE table full of dates from 1970 to 2038. Date connects to Session Requests via a many to one relationships, single way filter.
不幸的是,由于日期选择器表中的日期少于日期表,我得到...日期表是标准的日期表,包含从 1970 年到 2038 年的日期。日期通过多对一关系连接到会话请求,单向筛选。 Session Requests is the main fact table.
会话请求是主要事实表。
I need to get rid of the blank row in my result set via DAX so it does not appear in my chart on the X axis.我需要通过 DAX 删除结果集中的空白行,这样它就不会出现在图表中的 X 轴上。 I have tried lots of different DAX combos like blank () and NOT ISBLANK.
我尝试了很多不同的 DAX 组合,例如空白 () 和 NOT ISBLANK。 Do I need to create a table for the result set and then try to filter out the blank day there?
我是否需要为结果集创建一个表,然后尝试过滤掉那里的空白日?
You should not check if the result is empty but if the VALUE ( Table[DayNameShort] ) exists for your current row context:您不应该检查结果是否为空,而是检查当前行上下文是否存在 VALUE ( Table[DayNameShort] ):
RequestsWeekly =
VAR result =
CALCULATE (
DISTINCTCOUNTNOBLANK ( SessionRequests[RequestDateTime] ),
FILTER (
'Date',
'Date'[WeekDate]
= SELECTEDVALUE (
'DateSelector'[WeekDate],
MAX ( 'DateSelector'[WeekDate] )
)
)
) + 0
RETURN
IF (
NOT ISBLANK (
VALUE ( Table[DayNameShort] ) -- put here correct table name
),
result
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.