无法从Tablix使用数据集A范围A乡下数据集A范围,寻找替代解决方案
我有2个数据集(DSMAIN,dsholiday)。我一直在尝试使用数据集示波器DSMAIN的DATESTART和DATESEND之间的假期数,但是正如预期的那样,由于DSholiday不在Tablix的数据集范围之外,因此它无法正常工作。
我想提一下,DSMAIN从SQL查询中取出,而Dsholiday则从Power BI数据集中提取(最初是我加载到PBI数据集中的Excel文件,以便我可以将其拉入PBI报告构建器中)。
我只需要在每个记录的两个日期之间获得假期的数量。也就是说,在情况下,还有其他方法可以做这项工作吗?我尝试了下面的公式,但遇到了错误(取决于我是将其添加为计算字段还是字段表达式)。是否可以将两个日期用作查找条件,将日期仅将日期拉入一个文本行并计算组合文本中的日期值数量? (例如:对于ID:1,“ 05/02/2022,05/03/2022”)
我可以尝试任何线索或替代解决方案?
=SUM(
IIF(Fields!Date.Value >= Fields!DateStart.Value AND Fields!Date.Value <= Fields!DateEnd.Value, 1, 0),
"dsHoliday"
)
错误(将公式作为表达式添加时):
文本框“ textbox2”的值表达式指的是“ datestart”字段。 报告项目表达式只能参考当前数据集范围内的字段或 如果在聚合中,则指定的数据集范围。字段中的字母 必须使用正确的情况。
错误(当将公式添加为计算字段时):
用于计算的字段“测试”的表达式包括一个骨料, Rownumber,RunnunValue,以上或查找功能。总体,Rownumber, RunningValue,以前和查找功能无法在计算中使用 字段表达式。
DSMAIN
ID | COUNTARD | DATESTART | DATEDEND |
---|---|---|---|
1 | 突尼斯 | 05/01/2022 | 05/03/2022 |
2 | Tunisia | 05/02/02/2022 | 05/04/04/2022 |
3 | VIETNAM | 05/03/20222222222222222222222222222222222222222222 | 示例数据 |
转 | 集 | : 2022 | 05/04/2022 |
5 | 突尼斯 | 05/01/2022 | 05/01/2022 |
样本数据集Dsholiday Dsholiday:
Isweekeekend | Tunisia | Isholiday Isholiday | tunisia |
---|---|---|---|
tunisia | TRUE | FALSE | TUMISIA |
05/02/2022 | 05/03/03/2022 | TRUE | FALSE |
VIETNAM | 05/02/2022 | TRUE | FRAME FARE |
越南 | 05/03/2022 | TRUE | FALSE |
I have 2 datasets (dsMain, dsHoliday). I've been trying to get the number of holidays between the DateStart and DateEnd of a tablix with a dataset scope dsMain, but as expected it isn't working since the dsHoliday is outside of the tablix's dataset scope.
I'd like to mention, dsMain is pulled from a SQL query while the dsHoliday is pulled from a Power BI dataset (it was originally an Excel file that I loaded into a PBI dataset so that I can pull it into PBI Report Builder).
I only need to get the number of holidays between the two dates for each record. That said, is there some other way I can make this work given the circumstances? I tried the formula below but was getting an error (depending on whether I add it as a calculated field or a field expression). Is it possible maybe to use both dates as a LOOKUPSET condition to pull the dates into just one text line and count the number of date values in the combined text? (eg: for ID:1, "05/02/2022, 05/03/2022")
Any leads or alternate solutions I can try?
=SUM(
IIF(Fields!Date.Value >= Fields!DateStart.Value AND Fields!Date.Value <= Fields!DateEnd.Value, 1, 0),
"dsHoliday"
)
Error (when adding formula as an expression):
The Value expression for the text box 'Textbox2' refers to the field 'DateStart'.
Report item expressions can only refer to fields within the current dataset scope or,
if inside an aggregate, the specified dataset scope. Letters in the names of fields
must use the correct case.
Error (when adding formula as a calculated field):
The expression used for the calculated field 'Test' includes an aggregate,
RowNumber, RunningValue, Previous or lookup function. Aggregate, RowNumber,
RunningValue, Previous and lookup functions cannot be used in calculated
field expressions.
Sample dataset dsMain:
ID | Country | DateStart | DateEnd |
---|---|---|---|
1 | Tunisia | 05/01/2022 | 05/03/2022 |
2 | Tunisia | 05/02/2022 | 05/04/2022 |
3 | Vietnam | 05/03/2022 | 05/03/2022 |
4 | Vietnam | 05/01/2022 | 05/04/2022 |
5 | Tunisia | 05/01/2022 | 05/01/2022 |
Sample dataset dsHoliday:
Country | Date | IsHoliday | IsWeekend |
---|---|---|---|
Tunisia | 05/02/2022 | TRUE | FALSE |
Tunisia | 05/03/2022 | TRUE | FALSE |
Vietnam | 05/02/2022 | TRUE | FALSE |
Vietnam | 05/03/2022 | TRUE | FALSE |
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论