Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
OscarSuarez10
Helper III
Helper III

Payback problem

Hello I´m trying to use the following formula to get the payback, but when I got a problem when I use it, can you help me? 

The 'pruebas economicValues_global'[FLUJOCAJA ACUMULADO] is a measure what can i do?

payback problem 2.JPG

 

payback problem 3.JPG

8 REPLIES 8
Nathaniel_C
Super User
Super User

Hi @OscarSuarez10 , @AlB ,

Is the issue that DISTINCT returns a one-column table that contains the distinct values from the specified column. In other words, duplicate values are removed and only unique values are returned. Maybe DISTINCTCOUNT ?

Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hello @Nathaniel_C  I changed it to DISTINTCOUNT and i got the following mistake: 

column 'FLUCAJA ACUMULADO' in table 'pruebas economicValues_global' cannot be found or may not be used in this expression.

 

And it´s because 'FLUCAJA ACUMULADO' is not a column is a Measure, what can i do?


@OscarSuarez10 , So tell us what you are trying to do in Numerator.  BTW if you use a measure, you don't reference the table.

Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@Nathaniel_C  I´m trying to  get the absolute value of the last negative accumulated cash flow

@OscarSuarez10 

You cannot use DISTINCT() or DISTINCTCOUNT( ) on a measure. Both take columns as arguments. It's best practice to not use the name table with measures, i.e., you should just use

[FLUJOCAJA ACUMULADO]    instead of

'pruebas economicValues_global'[FLUJOCAJA ACUMULADO]

so that measures can be told apart from columns straight away.

You'd need to show the code for the measure [FLUJOCAJA ACUMULADO]. I believe we worked on this in another post a couple of days ago and it was solved at the time? And not with that measure. What has changed? 

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

@AlB  Im using this formula to calculate the cumulative cash flow:

 

payback problem 5.JPG

 

and i get the same values that i´m trying to add when I use it as a column, but when I use the same formula as a measure it works as you can see in the following table:

cumulative cash flow: as a column

flujocaja acumulado: as a measure

payback problem 6.JPG

AlB
Super User
Super User

Hi @OscarSuarez10 

You might to change

VAR Numerator_ = CALCULATE(DISTINCT(Table1[ACCUMULATED CASH FLOW]);Table1[YEAR] = Year_) 

to 

VAR Numerator_ = CALCULATE(DISTINCT(Table1[ACCUMULATED CASH FLOW]); FILTER( ALL(Table1[YEAR]),Table1[YEAR] = Year_) ) 

The names are a bit different but you get the idea. 

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

Hello @AlB  thanks for your help, I changed the script but I got the same mistake again: 

A function 'CALCULATE' has been used in a True/False expression that is used as a table filter expression. This is not allowed.

payback problem 4.JPG

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors