Forum Discussion

PwrBI01's avatar
PwrBI01
Post Patron
5 years ago
Solved

Cumulative value with Userelationship

Hi guys,   I have the following table (it contains the measure 'Pendiente de cobro'):       And I would like to obtain the following one:     The main problem is that the table cal...
  • PwrBI01's avatar
    PwrBI01
    5 years ago

    Hi guys,

     

    I have solved the problem.

     

    The measure I need to introduce is:

     

    Pendiente de cobro =
    Var Facturado = CALCULATE(SUM('T_FACTURACIONEXPEDIENTERESUMIDA'[TOTALAPAGAR]);'T_FACTURACIONEXPEDIENTERESUMIDA'[DIASSINCOBRAR]>0;USERELATIONSHIP(T_CALENDARIO[Fecha];'T_FACTURACIONEXPEDIENTERESUMIDA'[FECHAFACTURA]);FILTER(ALL(T_CALENDARIO[Fecha]);T_CALENDARIO[Fecha]<=MAX(T_CALENDARIO[Fecha])))
    Var Cobrado = CALCULATE(SUM('T_FACTURACIONEXPEDIENTERESUMIDA'[ENTRADA]);'T_FACTURACIONEXPEDIENTERESUMIDA'[DIASSINCOBRAR]>0;USERELATIONSHIP(T_CALENDARIO[Fecha];'T_FACTURACIONEXPEDIENTERESUMIDA'[FECHAFACTURA]);FILTER(ALL(T_CALENDARIO[Fecha]);T_CALENDARIO[Fecha]<=MAX(T_CALENDARIO[Fecha])))
    Var PendienteCobro = Facturado-Cobrado
    Return
    PendienteCobro