cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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
Anonymous
Not applicable

Helpful resources

Announcements
June 2022 update 768X460.jpg

Check it out!

Click here to read more about the June 2022 updates!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power BI Dev Camp Session 23 768x460.jpg

Check it Out!

Mark your calendars and join us on Thursday, June 30 at 11a PDT for a great session with Ted Pattison!

June 20 episode 7 with aka link 768x460.jpg

The Power BI Community Show

Join us on June 20 at 11 am PDT when Kim Manis shares the latest on Azure Synapse analytics, the Microsoft Intelligent Data Platform, and notable Power BI Updates from Microsoft Build 2022.

Top Solution Authors