Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Convert Tableau LOD expression to PowerBI DAX

Hello all,

I'd like to know how to convert this Tableau LOD expression into Power BI DAX. Could you help me, pls?

 

AVG(
{ EXCLUDE [Date],[Segment],[Store Name]:
SUM(
IF [Date] >= DATEADD('month',-7,[ReferenceMonth]) AND
[Date] <= DATEADD('month',-2,[ReferenceMonth])
THEN [Sales_Value] END) / 6 } )

 

Thanks in advance!

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous 

    Please try the following measure

    Measure =
      AVERAGEX(
                SUMMARIZE ( 'Table', 'Table'[Sales_Value] ),
                CALCULATE (
                    SUMX (
                         'Table',
                      IF ( [Date] >= DATEADD('Table'[ReferenceMonth],-7,MONTH) && [Date] <= DATEADD('Table'[ReferenceMonth],-2,MONTH),'Table'[Sales_Value]/6              
                        )
                    ),
                   ALLSELECTED('Table'[Date],'Table'[Segment],'Table'[Store Name])
                )
            )

    Best Regards

    Community Support Team _ Ailsa Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous 

    Please try the following measure

    Measure =
      AVERAGEX(
                SUMMARIZE ( 'Table', 'Table'[Sales_Value] ),
                CALCULATE (
                    SUMX (
                         'Table',
                      IF ( [Date] >= DATEADD('Table'[ReferenceMonth],-7,MONTH) && [Date] <= DATEADD('Table'[ReferenceMonth],-2,MONTH),'Table'[Sales_Value]/6              
                        )
                    ),
                   ALLSELECTED('Table'[Date],'Table'[Segment],'Table'[Store Name])
                )
            )

    Best Regards

    Community Support Team _ Ailsa Tao

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.