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 everyone,
I am new to DAX and need your support in solving this problem.
I have two Excel files. One contains yearly target planned for different activities while the second contains monthly reports of reached. I want to count those activities that are lagging behind.
1.
2.
I tried to do smoething like this but I got lost in the middle:
var maxMonth = MAX('Reached'[month])
var target_table =SUMMARIZE('Target', 'Target'[Activity], "Monthly Target", CALCULATE ( DIVIDE(SUM( 'Target'[Target] ),12,0)))
var beneficiary_table = SUMMARIZE('Reached', 'Reached'[Activity], "Monthly Reached", CALCULATE ( DIVIDE(SUM( 'Reached'[Reached] ),maxMonth,0)))
What I want is a measure that distinct counts activities that are lagging behind ie. Monthly Target > Monthly Reached.
I would very much appreacite your help.
Thank you
Solved! Go to Solution.
@enoch99 You can create a calculated column in Target table
Reached =
SUMX (
FILTER ( Reached, [Activity] = EARLIEST ( Target[Activity] ) ),
[Reached]
)
If you need a measure, then try the below measure
Lagging =
VAR _target =
ADDCOLUMNS (
Target,
"@Reached",
SUMX (
FILTER ( Reached, [Activity] = EARLIER ( Target[Activity] ) ),
[Reached]
)
)
VAR _result =
COUNTX ( FILTER ( _target, [@Reached] < [Target] ), [Activity] )
RETURN
_result
@enoch99 based on above dataset, what is the expected result. Can you mention that as well?
@nandukrishnavsI want a table like this:
I think I can compare the Target and Reached columns after that to count the number of activities lagging behind.
Thanks
@enoch99 You can create a calculated column in Target table
Reached =
SUMX (
FILTER ( Reached, [Activity] = EARLIEST ( Target[Activity] ) ),
[Reached]
)
If you need a measure, then try the below measure
Lagging =
VAR _target =
ADDCOLUMNS (
Target,
"@Reached",
SUMX (
FILTER ( Reached, [Activity] = EARLIER ( Target[Activity] ) ),
[Reached]
)
)
VAR _result =
COUNTX ( FILTER ( _target, [@Reached] < [Target] ), [Activity] )
RETURN
_result
@nandukrishnavs Thank you for your quick response. This is what I was looking for.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
7 | |
7 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |