Forum Discussion
Help with DAX in Measure
Hi guys, I need help with this:
I have this data:
| Producto | Women | dateformatted | Productos_MQL_CONS | Desembolsos |
| A | S | 21/3/2018 | S | 100 |
| A | N | 21/3/2018 | S | 200 |
| B | N | 21/3/2018 | N | 500 |
| B | N | 21/3/2018 | N | 800 |
| D | S | 21/3/2018 | S | 50 |
| E | S | 21/3/2018 | N | 100 |
| E | S | 21/3/2018 | N | 90 |
| A | N | 21/3/2018 | S | 800 |
| C | N | 21/3/2018 | S | 400 |
| C | N | 21/3/2018 | S | 500 |
| C | S | 21/3/2018 | S | 700 |
| C | S | 21/3/2018 | S | 600 |
| E | S | 21/3/2018 | N | 80 |
| D | N | 21/3/2018 | S | 144 |
| D | N | 21/3/2018 | S | 255 |
I have this measure:
| Producto | Desembolsos |
| A | 100 |
| C | 1300 |
| D | 50 |
| Producto | Desembolsos |
| A | 1100 |
| C | 2200 |
| D | 449 |
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
Most 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 regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic- ArquimedesP
Helper 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
Community 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.
- ArquimedesP
Helper II
Thanks a lot! This worked perfectly!