Forum Discussion

ArquimedesP's avatar
ArquimedesP
Icon for Helper II rankHelper II
5 years ago
Solved

Help with DAX in Measure

Hi guys, I need help with this:

 

I have this data:

 

ProductoWomendateformattedProductos_MQL_CONSDesembolsos
AS21/3/2018S100
AN21/3/2018S200
BN21/3/2018N500
BN21/3/2018N800
DS21/3/2018S50
ES21/3/2018N100
ES21/3/2018N90
AN21/3/2018S800
CN21/3/2018S400
CN21/3/2018S500
CS21/3/2018S700
CS21/3/2018S600
ES21/3/2018N80
DN21/3/2018S144
DN21/3/2018S255

 

I have this measure:

 

DESEMBOLSOS MQL 2 = CALCULATE(SUM(VW_BT_Desembolsos[Monto_MN]),VW_BT_Desembolsos[dateFormatted]>DATEVALUE("21/03/2018"),VW_BT_Desembolsos[Women]="S",VW_BT_Desembolsos[Productos_MQL_CONS]="S") 
 
Wich give me something like this:
 
ProductoDesembolsos
A100
C1300
D50
 
 
I need to do a new Measure that SUM all Desembolsos of the products selected before, and give me something like this:
 
ProductoDesembolsos
A1100
C2200
D449

 

Thanks

  • Hi ArquimedesP ,

    From your example I see that this part VW_BT_Desembolsos[dateFormatted]>DATEVALUE("21/03/2018") should be either VW_BT_Desembolsos[dateFormatted]>=DATEVALUE("21/03/2018") or ommited. Otherwise you won't get eny result (I'm looking just at the data sample).

    Anyway, if you need to include only products filtered by first measure, but sum all "Desembolsos", you can try this measure:

     

    Measure =
    VAR _t =
        CALCULATETABLE (
            VALUES ( T[Producto] ),
            T[dateformatted] >= DATEVALUE ( "3/21/2018" ),
            T[Women] = "S",
            T[Productos_MQL_CONS] = "S"
        )
    RETURN
        CALCULATE ( SUM ( T[Desembolsos] ), T[Producto] IN _t )

     

    If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.

4 Replies

  • selimovd's avatar
    selimovd
    Icon for Most Valuable Professional rankMost Valuable Professional

    Hey ArquimedesP ,

     

    I think the filter for [Women] gets you another result.

    The following should work:

    Desembolsos Version 2 =
    CALCULATE(
        SUM( VW_BT_Desembolsos[Desembolsos] ),
        VW_BT_Desembolsos[dateFormatted] > DATEVALUE( "21/03/2018" ),
        VW_BT_Desembolsos[Productos_MQL_CONS] = "S"
    )

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     

     

    • ArquimedesP's avatar
      ArquimedesP
      Icon for Helper II rankHelper II

      Thanks, but it didn't work. I have to sum de total of desembolsos for all the products selected in the Measure DESEMBOLSOS MQL 2. I'm thinking using a VAR but it hasnt worked.

  • ERD's avatar
    ERD
    Icon for Community Champion rankCommunity Champion

    Hi ArquimedesP ,

    From your example I see that this part VW_BT_Desembolsos[dateFormatted]>DATEVALUE("21/03/2018") should be either VW_BT_Desembolsos[dateFormatted]>=DATEVALUE("21/03/2018") or ommited. Otherwise you won't get eny result (I'm looking just at the data sample).

    Anyway, if you need to include only products filtered by first measure, but sum all "Desembolsos", you can try this measure:

     

    Measure =
    VAR _t =
        CALCULATETABLE (
            VALUES ( T[Producto] ),
            T[dateformatted] >= DATEVALUE ( "3/21/2018" ),
            T[Women] = "S",
            T[Productos_MQL_CONS] = "S"
        )
    RETURN
        CALCULATE ( SUM ( T[Desembolsos] ), T[Producto] IN _t )

     

    If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.