Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hey guys,
I hope all is well!
I'm looking for a DAX command that can produce the below results.
I have a series of weeks (not dates) that need to show a count up or down and ideally a percentage increase/decrease but I'm strugging to put this into Power BI
Week | Count | Result | Increase/Decrease |
Week 45 | 5 | ||
Week 46 | 6 | 1 | 20% |
Week 47 | 1 | -5 | -83.33% |
Week 48 | 7 | 6 | 600% |
Is someone able to support with this?
Thanks!
Steve
Solved! Go to Solution.
Hi!
This here might work, using a similar function as the Lag function
https://community.powerbi.com/t5/Desktop/Compute-Lead-and-Lag/td-p/425809
All the best,
Pétur
@Anonymous , refer my blog wow , the rank will help you
// That's pretty easy in fact if you have the
// right structure. The table that stores
// weeks must have a column that is a contiguous
// sequence of integers. Let's name the column
// WeekID. Normally, such a column would be hidden
// as it's just a key for the weeks to make them
// distinguishable from each other. This table
// will be connected to some fact table with
// measures.
[Week-by-Week Delta] =
IF(
// When we calculate the delta,
// we have to make sure that
// only one week is visible in
// the current context.
HASONEVALUE( Weeks[WeekID] ),
var __currentWeekId = SELECTEDVALUE( Weeks[WeekID] )
var __currentValue = [CountResult]
var __priorValue =
CALCULATE(
// This is the base measure
// of which you want to calculate
// the delta.
[CountResult],
Weeks[WeekID] = __currentWeek - 1
)
var __delta = __currentValue - __priorValue
return
__delta
)
[Increase/Decrease] = DIVIDE( [Week-by-Week Delta], [CountResult] )
You might need to adjust the measure to deal with boundary conditions. Simply test it and fix the places where it goes astray.
Best
D
Hi!
This here might work, using a similar function as the Lag function
https://community.powerbi.com/t5/Desktop/Compute-Lead-and-Lag/td-p/425809
All the best,
Pétur
Worked perfectly !
Thanks all 🙂
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
11 | |
10 | |
9 | |
8 |
User | Count |
---|---|
17 | |
12 | |
11 | |
11 | |
11 |