cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

calculated columns are not populated in Bridge table correctly

Hi,

Although this question directly relates to Azure Analysis Service but still posting in the power bi.

 

I have a model in AAS and there I have to create some calculated columns. First I tried to create that in on of the actual table and it gave me circular dependency (because in my model maximum of my actual tables are connected through bridge tables). Then I tried to implement those calculated columns in the bridge table but the column is coming as blank in report. When I debug the DAX I found that the filter (which I am using in DAX ) is not working when I am calculating the column.

I am sharing my code and the model snap shot here.

Capture1.JPGCapture2.JPG

 

CalculatedGTWDate_SLN::

=VAR GTWDate =

        SWITCH (

            TRUE (),

            ISBLANK ( MIN ( SFDC_Opportunity_NBV[GTWClosedDate] ) ), DATE ( 9999, 12, 31 ),

            DATE ( LEFT (

                CALCULATE (

                    MIN ( SFDC_Opportunity_NBV[GTWClosedDate] ),

                                                                        ALLEXCEPT (

                                                                                      SalesR48NBVBySolution,

                                                                                      CalculatedAccountNumber_NP[AccountNumber],

                                                                                      SalesR48NBVBySolution[Program],SalesR48NBVBySolution[L3Code]

                                                                        )

                ),

                4

            ), RIGHT (

                LEFT (

                    CALCULATE (

                        MIN ( SFDC_Opportunity_NBV[GTWClosedDate] ),

                                                                                      ALLEXCEPT (

                                                                                                    SalesR48NBVBySolution,

                                                                                                    CalculatedAccountNumber_NP[AccountNumber],

                                                                                                    SalesR48NBVBySolution[Program],SalesR48NBVBySolution[L3Code]

                                                                                      )

                    ),

                    7

                ),

                2

            ),1 )

        )

RETURN

   GTWDate

 

CalculatedFirstPurchaseDateAfterGTWCloseDate_SLN::

 

=VAR GTWDate = CalculatedAccountNumber_NP[CalculatedGTWDate_SLN]

RETURN

    CALCULATE (

        MIN ( SalesR48NBVBySolution[invoicedate] ),

        SalesR48NBVBySolution[InvoiceDate] >= GTWDate

    )

CalculatedCloseDateVSFirstPurchaseDate_SLN::

=DATEDIFF(CalculatedAccountNumber_NP[CalculatedFirstPurchasedateAfterGTWClosedDate_SLN], MAX(SFDC_Opportunity_NBV[ClosedMonth]),MONTH)

 

CalculatedAnnualization_SLN::

=VAR Denominator = (CalculatedAccountNumber_NP[CalculatedClosedDateVSFirstPurchaseDate_SLN]+ 1 )

VAR Sales =

    CALCULATE (

        SUM ( SalesR48NBVBySolution[TotalSales] ),

        FILTER (

            SalesR48NBVBySolution,

            SalesR48NBVBySolution[invoicedate] >= CalculatedAccountNumber_NP[CalculatedFirstPurchasedateAfterGTWClosedDate_SLN]

        )

    )

VAR R6AnchorSales =

    CALCULATE (

        SUM ( SalesR48NBVBySolution[TotalSales] ),

        FILTER (

            SalesR48NBVBySolution,

            SalesR48NBVBySolution[invoicedate]

                >= EDATE (

                     CalculatedAccountNumber_NP[CalculatedFirstPurchasedateAfterGTWClosedDate_SLN],

                    -6

                )

                && SalesR48NBVBySolution[invoicedate] < CalculatedAccountNumber_NP[CalculatedFirstPurchasedateAfterGTWClosedDate_SLN]

              

 

        )

    )

RETURN

    IF ( ISBLANK ( R6AnchorSales ),

        IF ( NOT (ISBLANK (  CalculatedAccountNumber_NP[CalculatedFirstPurchasedateAfterGTWClosedDate_SLN])

            )

                && ISBLANK ( R6AnchorSales ),

            DIVIDE ( Sales, Denominator ) * 12

        )

    )

 

 

Note::Other than CalculatedAnnualization_SLN the columns are populating fine in the report.

 

Could you please guide me how to resolve this

1 REPLY 1
Highlighted
Anonymous
Not applicable

Re: calculated columns are not populated in Bridge table correctly

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

July 2020 Community Highlights

July 2020 Community Highlights

Learn about the exciting things that happened in July.

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

We are thrilled to announce we will begin running a monthly webinar series named Power BI Dev Camp.

Power BI Desktop August 2020 Update

Power BI Desktop August 2020 Update

We have great updates this month! Click the link for the video with more info.