Forum Discussion

renaudgaillard's avatar
renaudgaillard
Frequent Visitor
9 years ago

How to transform text formula coming from SQL into working measure ?

Hi all,

 

I'm trying to automatize financials formulas.

They are in Power Bi DAX code and stored into a SQL database server.

 

So, I've created this measure :

AutoFin = CALCULATE(VALUES(tbl_cusformula[cusformula_value]); tbl_cusformula[cusformula_description] = "AutoFin")

 

The result of the CALCULATE function returns my formula :

(CALCULATE(SUM('GLEntryDW'[Amount]); 'GLEntryDW'[GLAccountNo2]="10") + CALCULATE(SUM('GLEntryDW'[Amount]); 'GLEntryDW'[GLAccountNo2]="14") ...........

 

But it doesn't work.

I think Power Bi interpates the result as a text.
If I copy/paste this result into a new measure it's working.

 

Does someone has any idea to make this working ?

 

Thanks a lot.

 

Regards

 

 

3 Replies

  • v-yulgu-msft's avatar
    v-yulgu-msft
    Microsoft Employee

    Hi renaudgaillard,

     

    According to your description, what you want to get is the calculate result of the text "(CALCULATE(SUM('GLEntryDW'[Amount]); 'GLEntryDW'[GLAccountNo2]="10") + CALCULATE(SUM('GLEntryDW'[Amount]); 'GLEntryDW'[GLAccountNo2]="14") " which is returned by the original measure, right?

     

    Currently, this requirement cannot be achieved. The returned result by the measure is regarded as a common string rather than a measure which can run the function again.

     

    Best regards,
    Yuliana Gu

  • Hi all,

     

    Does someone has the same objective and has solution ?

     

    Thank you !