I’ve got a query I built in TE3 that returns a result. It’s hard-coded for testing purposes.
I’ve built a table in PB that is filtered to what the DAX Query (attached) is using. I want to build a measure (pasted in a code block below) that I can then compare against each row of the table.
What I was expecting when I placed the measure on the table is that the number would be repeated on each row.
My first step is simply displaying the value of the measure on the row. It returns a blank.
My second step, if it had worked, would be to build a measure that compares the Amounts - Source value to the “Unusual Items Value Filter” measure. If Amounts - Source is greater than “Unusual Items Value Filter”, return a 1, otherwise return a zero.
I would then put this new measure in as a filter and only show rows where the value is 1.
AVERAGEX with virtual table.pbix (3.7 MB)
DAX Query 1.dax (2.0 KB)
Unusual Item Filter Value =
VAR selectedComparison = "Total Operating Revenue"
VAR selectedReportName = "260 Report Name"
VAR selectedMonthOffSet = 0
VAR selectedCaption = "Medical"
VAR selectedCompany =
MINX( FILTER( 'structure', 'structure'[Report Name] = selectedReportName ), 'structure'[Reporting Company] )
VAR ActCompNum =
CALCULATE(
[MTD Source],
KEEPFILTERS( cost_centers[Reporting Company] = selectedCompany ),
KEEPFILTERS( calendar[Month Offset] = selectedMonthOffSet ),
KEEPFILTERS( captions[Caption] = selectedComparison )
)
VAR ActCompDen =
CALCULATE(
[MTD Source],
KEEPFILTERS( cost_centers[Reporting Company] = selectedCompany ),
KEEPFILTERS( calendar[Month Offset] = selectedMonthOffSet ),
KEEPFILTERS( captions[Caption] = selectedCaption )
)
VAR BudCompNum =
CALCULATE(
[MTD Budget],
KEEPFILTERS( cost_centers[Reporting Company] = selectedCompany ),
KEEPFILTERS( calendar[Month Offset] = selectedMonthOffSet ),
KEEPFILTERS( captions[Caption] = selectedComparison )
)
VAR BudCompDen =
CALCULATE(
[MTD Budget],
KEEPFILTERS( cost_centers[Reporting Company] = selectedCompany ),
KEEPFILTERS( calendar[Month Offset] = selectedMonthOffSet ),
KEEPFILTERS( captions[Caption] = selectedCaption )
)
VAR ActRatio = DIVIDE( ActCompNum, ActCompDen )
VAR BudRatio = DIVIDE( BudCompNum, BudCompDen )
VAR BudActRatio = DIVIDE( BudRatio, ActRatio )
VAR FV1 =
CALCULATETABLE(
SELECTCOLUMNS(
amounts,
"CC", RELATED( cost_centers[Cost Center] ),
"Acct",RELATED( chart_of_accounts[Account ID] ),
"@WeightedAvgBud", [Amounts - Budget] * BudActRatio
),
'calendar'[Month Offset]=selectedMonthOffSet,
cost_centers[Reporting Company]=selectedCompany,
captions[Caption]=selectedCaption
)
VAR FV2 = AVERAGEX(FV1,[@WeightedAvgBud])
RETURN
FV2