cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ArquimedesP
Helper I
Helper I

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

1 ACCEPTED SOLUTION
ERD
Super User
Super User

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 )

 

ERD_0-1624433518496.png

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

View solution in original post

4 REPLIES 4
ERD
Super User
Super User

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 )

 

ERD_0-1624433518496.png

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

View solution in original post

Thanks a lot! This worked perfectly! 

selimovd
Super User
Super User

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
 

 

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.

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power BI October Update 2021.jpg

Power BI Release

Click here to read more about the October 2021 Release!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Teds Dev Camp Oct. 2021 768x460.jpg

Power BI Dev Camp - October 28th, 2021

Mark your calendars and join us for our next Power BI Dev Camp!