The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I'm trying to replicate a table created by a SQL Query in DAX with a Computed Table. I'm getting the error "A Function 'PLACEHOLDER' has been used in a True/False expression that isused as a table filter expression. This is not allowed."
If anyone's able to review the original SQL code and give feedback on my attempts at replicating in DAX, it would be much appreciated!
Here's the original SQL Code:
SELECT Left([KMS],2) AS YearOfRec, [Table].KMS AS [Number of Reports], Count([Table].RecommendationNumber) AS [Number of Unimplemented Recommendations], Sum(IIf([PriorPeriodAdj]<>0 And [PriorPeriodAdjDate]<[Forms]![frm_SummaryTableSAR]![Text_PeriodStart],QCAdjusted([Questioned],[PriorPeriodAdj]),[Questioned])) AS QuestionedCostA, Sum([Table].BetterUse) AS SumOfBetterUse, Sum([Table].QuestionedSustained) AS SumOfQuestionedSustained, [Table].ResolutionDate
FROM [Table]
WHERE
(
(
(
([Table].KMS) Like "??-1-???" Or ([Table].KMS) Like "??-2-???" Or ([Table].KMS) Like "??-3-???" Or ([Table].KMS) Like "??-6-???")
)
AND (([Table].ActIssueDate)<=Forms!frm_SummaryTableSAR!Text_PeriodStart)
AND (([Table].FinalActionDate) Is Null)
AND (([Table].Rec_Status_Text)<>"NoLongerApplicable")
)
OR
(
(
(
([Table].KMS) Like "??-1-???" Or ([Table].KMS) Like "??-2-???" Or ([Table].KMS) Like "??-3-???" Or ([Table].KMS) Like "??-6-???")
)
AND (([Table].ActIssueDate)<=Forms!frm_SummaryTableSAR!Text_PeriodStart)
AND (([Table].FinalActionDate)>Forms!frm_SummaryTableSAR!Text_PeriodEnd)
AND (([Table].Rec_Status_Text)<>"NoLongerApplicable")
)
)
GROUP BY Left([KMS],2), [Table].KMS, [Table].ResolutionDate;
I've done the following in Power Query:
1. Created the Table
2. Created a computed column "Report Title FY" to replace LEFT([KMS],2)
3. Created a computed column "Report Type" to replace (KMS) Like "??-X-???"
Then, in Power BI, I:
4. To replace [Forms]![frm_SummaryTableSAR]![Text_PeriodStart]
created measure:
5. To replace Sum(IIf([PriorPeriodAdj]<>0 And [PriorPeriodAdjDate]<[Forms]![frm_SummaryTableSAR]![Text_PeriodStart],QCAdjusted([Questioned],[PriorPeriodAdj]),[Questioned])) AS QuestionedCostA
created measure:
SummaryA_CalcTable_QuestionedCostA = IF(
MIN('All Projects wRecs'[Prior Period Adj Date])< SAR_Period_DateDim[SAR_START]
&&
MIN('All Projects wRecs'[Prior Period Adjustment]) <> 0,
SUMX('All Projects wRecs',[Sum of Questioned Costs] + [Sum of Prior Period Adj]),
SUM('All Projects wRecs'[Sum of Questioned Costs])
)
6. To replace Forms!frm_SummaryTableSAR!Text_PeriodEnd
created measure:
The error message is giving you the guidance on how to fix it. Work on defangling your filter statement. Remove all filters and then add them in one by one to see where it breaks. You will also be able to use variables to work around the "multiple sources" issue.
User | Count |
---|---|
28 | |
12 | |
8 | |
7 | |
5 |
User | Count |
---|---|
36 | |
14 | |
12 | |
7 | |
7 |