Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi everybody!
I want to calculate column D in this example with DAX.
I try to do it with this code, but I have some mistakes in the results.
I don't know if you need more information to try help me.
Thank you very much,
Solved! Go to Solution.
Ok. That is different from what I had understood earlier. See it all at work in the attached file:
NewMeasure =
VAR total_ = CALCULATE ( COUNT ( Table1[Estancia Fábrica] ), ALL ( Table1 ) )
VAR currentEst_ = SELECTEDVALUE ( Table1[Estancia Fábrica], total_ )
VAR cumul_ =
CALCULATE (
COUNT ( Table1[Estancia Fábrica] ),
Table1[Estancia Fábrica] <= currentEst_,
ALL ( Table1 )
)
RETURN
DIVIDE ( cumul_, total_ )
|
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Ok. That is different from what I had understood earlier. See it all at work in the attached file:
NewMeasure =
VAR total_ = CALCULATE ( COUNT ( Table1[Estancia Fábrica] ), ALL ( Table1 ) )
VAR currentEst_ = SELECTEDVALUE ( Table1[Estancia Fábrica], total_ )
VAR cumul_ =
CALCULATE (
COUNT ( Table1[Estancia Fábrica] ),
Table1[Estancia Fábrica] <= currentEst_,
ALL ( Table1 )
)
RETURN
DIVIDE ( cumul_, total_ )
|
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Thank you very much for your time. The solution is perfect!
Thank you... of course I do.
I'm new to the forum, so I have no idea how I can share it.
Sorry, I look forward to that.
The significant column is "Estancia Fábrica"
You have to share the URL to the file hosted elsewhere: Dropbox, Onedrive... or just upload the file to a site like tinyupload.com (no sign-up required).
Be careful not to share confidential information
|
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Hi @MTrullàs
I assume you're looking for a calculated column. If so, create this and format as %:
NewCol_ =
VAR total_ = CALCULATE ( SUM ( HIFA[Num_Coches] ), ALL ( HIFA ) )
VAR cumul_ =
CALCULATE (
SUM ( HIFA[Num_Coches] ),
HIFA[Estancia Fábrica] <= EARLIER ( HIFA[Estancia Fábrica] ),
ALL ( HIFA )
)
RETURN
DIVIDE ( cumul_, total_ )
|
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Hello,
Thanks a lot for the quick answer,
No, I'm lookin' for a metric.I need a measure, because I want to build a board like this:
Before, I have a table with different rows, therefore, I made a cluster with the same "Estancia Fábrica", so I need a metric.
Thank you again, for your help
See if this measure works. It should be in a visual with HIFA[Estancia fábrica] on the rows, like the ones you show:
NewMeasure_ =
VAR total_ = CALCULATE ( SUM ( HIFA[Num_Coches] ), ALL ( HIFA ) )
VAR currentEst_ = SELECTEDVALUE ( HIFA[Estancia Fábrica] )
VAR cumul_ =
CALCULATE (
SUM ( HIFA[Num_Coches] ),
HIFA[Estancia Fábrica] <= currentEst_,
ALL ( HIFA )
)
RETURN
DIVIDE ( cumul_, total_ )
|
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Thank you so much,
Now the measure works, I mean it gives me a result, but the result is not what I'm looking for.I don't know what the NewMeasure_is specifically
I the result that I expected is that the excel shows:
hmm... I can't see what might be going wrong
Can you share the main table? Or an extract of it, with the expected result. So that I can run it on my side and see where the problem is coming from
|
|
Please accept the solution when done and consider giving a thumbs up if posts are helpful. Contact me privately for support with any larger-scale BI needs, tutoring, etc. |
Thank you... of course I do.
I'm new to the forum, so I have no idea how I can share it.
Sorry, I look forward to that.
The significant column is "Estancia Fábrica"
Sorry, now I try again,
| Fgstnr | Fábrica | Campa | Semana | Mes | Año | Marca | Estancia Fábrica |
| 1 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 |
| 2 | Mar | Sch | 14 | Abril | 2022 | Sea | 2 |
| 3 | Mar | Sch | 14 | Abril | 2022 | Sea | 3 |
| 4 | Mar | Sch | 14 | Abril | 2022 | Sea | 4 |
| 5 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 |
| 6 | Mar | Sch | 14 | Abril | 2022 | Sea | 2 |
| 7 | Mar | Sch | 14 | Abril | 2022 | Sea | 3 |
| 8 | Mar | Sch | 14 | Abril | 2022 | Sea | 4 |
| 9 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 |
| 10 | Mar | Sch | 14 | Abril | 2022 | Sea | 2 |
| 11 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 |
| 12 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 |
| 13 | Mar | Sch | 14 | Abril | 2022 | Sea | 2 |
| 14 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 |
| 15 | Mar | Sch | 14 | Abril | 2022 | Sea | 0 |
| 16 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 |
| 17 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 |
| 18 | Mar | Sch | 14 | Abril | 2022 | Sea | 0 |
| 19 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 |
| 20 | Mar | Sch | 14 | Abril | 2022 | Sea | 2 |
| 21 | Mar | Sch | 14 | Abril | 2022 | Sea | 0 |
| 22 | Mar | Sch | 14 | Abril | 2022 | Sea | 0 |
| 23 | Mar | Sch | 14 | Abril | 2022 | Sea | 0 |
More info,... thank you so much for your time.
| Fgstnr | Fábrica | Campa | Semana | Mes | Año | Marca | Estancia Fábrica | |||||
| 1 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 | |||||
| 2 | Mar | Sch | 14 | Abril | 2022 | Sea | 2 | Etiquetas de fila | Cuenta de Estancia Fábrica | objective | ||
| 3 | Mar | Sch | 14 | Abril | 2022 | Sea | 3 | 0 | 5 | 22% | ||
| 4 | Mar | Sch | 14 | Abril | 2022 | Sea | 4 | 1 | 9 | 61% | ||
| 5 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 | 2 | 5 | 83% | ||
| 6 | Mar | Sch | 14 | Abril | 2022 | Sea | 2 | 3 | 2 | 91% | ||
| 7 | Mar | Sch | 14 | Abril | 2022 | Sea | 3 | 4 | 2 | 100% | ||
| 8 | Mar | Sch | 14 | Abril | 2022 | Sea | 4 | Total general | 23 | |||
| 9 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 | |||||
| 10 | Mar | Sch | 14 | Abril | 2022 | Sea | 2 | |||||
| 11 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 | |||||
| 12 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 | |||||
| 13 | Mar | Sch | 14 | Abril | 2022 | Sea | 2 | |||||
| 14 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 | |||||
| 15 | Mar | Sch | 14 | Abril | 2022 | Sea | 0 | |||||
| 16 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 | |||||
| 17 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 | |||||
| 18 | Mar | Sch | 14 | Abril | 2022 | Sea | 0 | |||||
| 19 | Mar | Sch | 14 | Abril | 2022 | Sea | 1 | |||||
| 20 | Mar | Sch | 14 | Abril | 2022 | Sea | 2 | |||||
| 21 | Mar | Sch | 14 | Abril | 2022 | Sea | 0 | |||||
| 22 | Mar | Sch | 14 | Abril | 2022 | Sea | 0 | |||||
| 23 | Mar | Sch | 14 | Abril | 2022 | Sea | 0 |
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 4 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 23 | |
| 12 | |
| 11 | |
| 9 | |
| 8 |