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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

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.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors