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
Borja204
Helper II
Helper II

How to get a measure based on a condition determined by other measure

Hello!

 

I've been dealing with a problem that I haven't been able to resolve. I'll try to explain the best I can:

 

This is my model:

 

Borja204_0-1611213751659.png

 

The part of the model that is involved in thos problem are Projects (Iniciativas), Weights (Pesos) And Progresses (Avances).

 

One of the visuals that I have in one of the reports is like this:

Borja204_1-1611213874184.png

Basically it represents the total numer of projects in the year you are currently seeing, the total progress of all the projects calculated taking account their weight in the year-month you are currently seeing and the total objective at the end of the year taking into account also the weight of each project (this one is almost always going to be 100 because the sum of weight per project per year is 100, but it may be different).

 

These are the measures that I wrote to get this:

 

Projects in the current year:

Nº Iniciativas en el año =
CALCULATE( COUNTROWS(Pesos),
FILTER((Pesos),
Pesos[Año] = MAX(Fechas[Año])
)
)
 
Accumulated progress by weight (second number):
Avance DD acumulado por peso = SUMX ( Iniciativas, [Avance DD Acumulado en el año] * [Peso DD en el año])
 
Avance DD Acumulado en el año =
CALCULATE( SUM(Avances[Real Mes DD]),
FILTER(ALL(Avances),
Avances[AñoMes] <= MAX(Fechas[AñoMes]) &&
Avances[Código] = MAX(Iniciativas[Código]) &&
LEFT(Avances[AñoMes], 4) >= LEFT(MAX(Fechas[AñoMes]), 4)
)
)
 
Peso DD en el año = CALCULATE (
MAX(Pesos[Peso IDD]),
FILTER ( ALL ( Pesos ),
Pesos[Año] = MAX ( Fechas[Año] ) &&
Pesos[Código] = MAX( Iniciativas[Código] )
)
)
 
And the 3rd value measure, the objective one:
Objetivo DD fin de año por peso = SUMX ( Iniciativas, [Objetivo DD Fin de año] * [Peso DD en el año])

 

Objetivo DD Fin de año = CALCULATE( SUM(Avances[Objetivo Mes DD]),
FILTER(ALL(Avances),
Avances[Código] = MAX(Iniciativas[Código]) &&
Left(Avances[AñoMes], 4) <= Left(MAX(Fechas[AñoMes]), 4) &&
LEFT(Avances[AñoMes], 4) >= LEFT(MAX(Fechas[AñoMes]), 4)
))
 
The point is that now, I do need to have this visual but "appliying" a filter. I need to have the same visual but showing the projects that are open, the ones that are closed and the same visual that I showed before, that is the total. The main issue that I'm facing here is that the "is Open" or "is Closed" is something that depends on the progress that a project have each month. A project finished is that that in a year, have reached 100% of progress. Is not something that I could create in a calculated column because the state changes depending on the year and month you are seeing.
 
I created a simple measure that represents the status of a project, and when I put it in a table, it shows it correctly per project depending on the year-month I select (Basically if progress accumulated in year then):
 
Iniciativa Estado DD = IF([Avance DD Acumulado en el año] > 0.99, "Cerrada", "Abierta").
 
So, I've tried to duplicate the visual above, the one with the 3 measures, and apply a filter to those visuals so I could reuse the same visual with the same measures, but filtered by the status of the project. Unfortunately, it is not working.
 
Then I though, ok, lets create another 6 measures. Same like the 3 ones that I had, but taking into account only the projects that matches the condition determined by the status measure. And here is where I am stuck. Btw, I am not an expert in power Bi so maybe it is much simpler than I think.
 
How can I get this measure (the projects count in the year): 

 

Projects in the current year:

Nº Iniciativas en el año =
CALCULATE( COUNTROWS(Pesos),
FILTER((Pesos),
Pesos[Año] = MAX(Fechas[Año])
)
)
 
count only the projects with status "open" (abierta) which is get by this other measure?:
 
Iniciativa Estado DD = IF([Avance DD Acumulado en el año] > 0.99, "Cerrada", "Abierta").
 
I'm  a bit lost, any help is highly apreciated.
 
Thanks in advance,
 
Regards
 
 

 

2 REPLIES 2
Borja204
Helper II
Helper II

If anyone needs any further explanation just send me a message or let a message here 🙂

Hi @Borja204 

Could you provide a sample file with me? 

And you can show me a screenshot of the result you want.

This may make it easier for me to understand your requirement.

 

Best Regards,

Rico Zhou

 

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

 

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.