Forum Discussion
Anonymous
1 year agoNot applicable
Tableau Function to Power BI
I'm needing to migrate this Tableau code to Power BI and have had no luck doing so. IF [Frequency]='Monthly' THEN { FIXED [Work Item ID],[Savings],[Frequency] : AVG(DATEDIFF('month',[Closed...
- 1 year ago
Hi Anonymous try the below measure and let me know if it helps.
MonthlyAvgAmountMeasure =
VAR FilteredTable =
FILTER (
ALL ( 'Table' ),
'Table'[Frequency] = "Monthly"
&& NOT ISBLANK ( 'Table'[Closed Date] )
)
RETURN
AVERAGEX (
SUMMARIZE (
FilteredTable,
'Table'[Work Item ID],
'Table'[Savings],
'Table'[Frequency],
"CalcVal", DATEDIFF ( 'Table'[Closed Date], TODAY(), MONTH ) * 'Table'[Amount]
),
[CalcVal]
)
danextian
1 year agoSuper User
Hi Anonymous
It's been a long long while since I last used Tableu. Try below as a measure
Monthly Savings Estimate =
IF (
SELECTEDVALUE ( 'DataTable'[Frequency] ) = "Monthly",
AVERAGEX (
SUMMARIZE (
'DataTable',
'DataTable'[Work Item ID],
'DataTable'[Savings],
'DataTable'[Frequency],
"MonthsSinceClosed", DATEDIFF ( 'DataTable'[Closed Date], TODAY(), MONTH ) * 'DataTable'[Amount]
),
[MonthsSinceClosed]
),
0
)