Forum Discussion
tanako123
8 years agoNew Member
From Tableau to PowerBI DAX
Hello I am currenctly trying to get diffrent reports from Tableau to DAX. I am really a beginner at DAX but can someone exaplain what the formula below in Tabluea does and help me convert it to ...
- 8 years ago
Hi tanako123
Your Tableau formula is the equivalent of a calculated column that says:
- For each row, examine all rows with [FormulierId] equal to the value in the current row
- If any of those rows has [Type melding (group)] with substring 'Reguliere melding' then return 'Reguliere melding'
- Else if any of those rows has [Type melding (group)] with substring 'Politiemelding' then return 'Politiemelding'
- Else return Null
The DAX equivalent would have to be a calculated column with code like this (I'm calling the table Data):
Calculated Column = IF ( NOT ( ISEMPTY ( CALCULATETABLE ( VALUES ( Data[Type melding (group)] ), ALLEXCEPT ( Data, Data[FormulierId] ), NOT ( ISERROR ( FIND ( "Reguliere melding", Data[Type melding (group)] ) ) ) ) ) ), "Reguliere melding", IF ( NOT ( ISEMPTY ( CALCULATETABLE ( VALUES ( Data[Type melding (group)] ), ALLEXCEPT ( Data, Data[FormulierId] ), NOT ( ISERROR ( FIND ( "Politiemelding", Data[Type melding (group)] ) ) ) ) ) ), "Politiemelding" ) )By the way, the Tableau formula is written a little strangely, since
{ FIXED [FormulierId]:MAX('Reguliere melding')}could be replaced with
'Reguliere melding'
but this could be because it started off as something more complex.
Regards,
Owen
OwenAuger
Super User
8 years agoHi tanako123
Your Tableau formula is the equivalent of a calculated column that says:
- For each row, examine all rows with [FormulierId] equal to the value in the current row
- If any of those rows has [Type melding (group)] with substring 'Reguliere melding' then return 'Reguliere melding'
- Else if any of those rows has [Type melding (group)] with substring 'Politiemelding' then return 'Politiemelding'
- Else return Null
The DAX equivalent would have to be a calculated column with code like this (I'm calling the table Data):
Calculated Column =
IF (
NOT (
ISEMPTY (
CALCULATETABLE (
VALUES ( Data[Type melding (group)] ),
ALLEXCEPT ( Data, Data[FormulierId] ),
NOT ( ISERROR ( FIND ( "Reguliere melding", Data[Type melding (group)] ) ) )
)
)
),
"Reguliere melding",
IF (
NOT (
ISEMPTY (
CALCULATETABLE (
VALUES ( Data[Type melding (group)] ),
ALLEXCEPT ( Data, Data[FormulierId] ),
NOT ( ISERROR ( FIND ( "Politiemelding", Data[Type melding (group)] ) ) )
)
)
),
"Politiemelding"
)
)
By the way, the Tableau formula is written a little strangely, since
{ FIXED [FormulierId]:MAX('Reguliere melding')}could be replaced with
'Reguliere melding'
but this could be because it started off as something more complex.
Regards,
Owen