Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I have the following measure calculating project progress.
RPnew =
VAR StatusDate = [StatusDate]
VAR Result =
CALCULATE (
SUMX (
FILTER ( RP, RP[Group] = "Design" ),
RP[Progress] * RELATED ( IW[Weighting] )
* RELATED ( GW[Weighting] )
)
+ SUMX (
FILTER ( RP, RP[Group] = "Purchasing" ),
RP[Progress] * RELATED ( IW[Weighting] )
* RELATED ( GW[Weighting] )
)
+ SUMX (
FILTER ( RP, RP[Group] = "Construction" ),
RP[Progress] * RELATED ( IW[Weighting] )
* RELATED ( GW[Weighting] )
)
+ SUMX (
FILTER ( RP, RP[Group] = "Commissioning" ),
RP[Progress] * RELATED ( IW[Weighting] )
* RELATED ( GW[Weighting] )
),
RP[Date] <= EOMONTH ( StatusDate, 0 )
)
RETURN
Result
I have progress data beyond the Status date (which is 31.08.2021) in this case, this is why I have to limit the calculation within the Status date which is working. This is the result:
Even though progress data is available also after 31.08.2021 it show only data within that date.
To make the code more readable I wanted to use variables.
RPnew =
VAR StatusDate = [StatusDate]
VAR DRP =
SUMX (
FILTER ( RP, RP[Group] = "Design" ),
RP[Progress] * RELATED ( IW[Weighting] )
* RELATED ( GW[Weighting] )
)
VAR PRP =
SUMX (
FILTER ( RP, RP[Group] = "Purchasing" ),
RP[Progress] * RELATED ( IW[Weighting] )
* RELATED ( GW[Weighting] )
)
VAR CRP =
SUMX (
FILTER ( RP, RP[Group] = "Construction" ),
RP[Progress] * RELATED ( IW[Weighting] )
* RELATED ( GW[Weighting] )
)
VAR COMRP =
SUMX (
FILTER ( RP, RP[Group] = "Commissioning" ),
RP[Progress] * RELATED ( IW[Weighting] )
* RELATED ( GW[Weighting] )
)
VAR RealProgress = DRP + PRP + CRP + COMRP
VAR Result =
CALCULATE ( RealProgress, RP[Date] <= EOMONTH ( StatusDate, 0 ) )
RETURN
Result
However with this code the calculation is not anymore limited to the Status date which is 31.08.2021 and I don't understand why.
Thanks in advance
Br
Any particular reason for using RELATED() in a measure?
You can also simplify your filter quite a bit
FILTER ( RP, RP[Group] IN {"Design","Purchasing","Construction","Commissioning"} )
Hi @lbendlin,
this is my data model
The table IW and GW are on the one side of the relationship to RP this is why I'm using RELATED() to access the Weighting values in IW and GW.
Hi,
any suggestions as to why the same formula works without but does not work using variables?
Br
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
71 | |
70 | |
43 | |
31 | |
26 |
User | Count |
---|---|
89 | |
49 | |
44 | |
38 | |
37 |