无法从Tablix使用数据集A范围A乡下数据集A范围,寻找替代解决方案

发布于 2025-02-01 04:35:34 字数 2022 浏览 2 评论 0原文

我有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

IDCOUNTARDDATESTARTDATEDEND
1突尼斯05/01/202205/03/2022
2Tunisia05/02/02/202205/04/04/2022
3VIETNAM05/03/20222222222222222222222222222222222222222222示例数据
: 202205/04/2022
5突尼斯05/01/202205/01/2022

样本数据集Dsholiday Dsholiday:

IsweekeekendTunisiaIsholiday Isholidaytunisia
tunisiaTRUEFALSETUMISIA
05/02/202205/03/03/2022TRUEFALSE
VIETNAM05/02/2022TRUEFRAME FARE
越南05/03/2022TRUEFALSE

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:

IDCountryDateStartDateEnd
1Tunisia05/01/202205/03/2022
2Tunisia05/02/202205/04/2022
3Vietnam05/03/202205/03/2022
4Vietnam05/01/202205/04/2022
5Tunisia05/01/202205/01/2022

Sample dataset dsHoliday:

CountryDateIsHolidayIsWeekend
Tunisia05/02/2022TRUEFALSE
Tunisia05/03/2022TRUEFALSE
Vietnam05/02/2022TRUEFALSE
Vietnam05/03/2022TRUEFALSE

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文