- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Trend Visualization compared to previous week
Hi,
I try to visualize a change in a number (a sum of trucks per week) compared to the previous calender week.
For example...in Calendar Week 15 I counted 380 and in Calendar week 16 I counted 368. I now want to have a visual where I see a trend based on the previous week. In this case a negativ trend as the number went down.
Problem for me is to define something which is only looking at the previous CW.
Yes I´m working with a date table and already sorted out how to add a WeekNum in there.
Please note that I´m quite new to PBI.
Thanks for your help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The myMax variable is essentially grabbing the current weeknum in the context of your visual. So, myMax - 1 essentially dials this back a week. So, if your current week is 16, when you are filtering for last week you want the rows where WeekNum is 15.
Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!: Power BI Cookbook Third Edition (Color)
DAX is easy, CALCULATE makes DAX hard...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you post some mock data in text that can be easily copied and pasted? Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
In general however, you should be able to create a measure that does a MAX of your weeknum and then you would use FILTER(ALL(),[weeknum]=yourmax) like:
Measure = VAR myMax = MAX('Table'[WeekNum]) VAR myCount = SUM('Table'[Trucks]) VAR tmpTable = FILTER(ALL('Table'),[WeekNum]=myMax-1) VAR lastWeekCount = COUNTX(tmpTable,[Trucks]) RETURN myCount - lastWeekCount
Totally guessing here because no mock data.
Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!: Power BI Cookbook Third Edition (Color)
DAX is easy, CALCULATE makes DAX hard...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Greg,
Sorry I read your post too late.
I was able to adjust the formula given above
Trend Truck = VAR myMax = MAX('Date'[WeekNum]) VAR myCount = SUM('Table1'[Anzahl Trucks]) VAR tmpTable = FILTER(ALL('Date');[WeekNum]=myMax-1) VAR lastWeekCount = COUNTX(tmpTable;[Anzahl Trucks]) RETURN myCount - lastWeekCount
I think I understand what you did there but what does "myMax-1" do?
What Visual would you use to display a trend "this week compared to last week"?
Thanks for your help so far!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The myMax variable is essentially grabbing the current weeknum in the context of your visual. So, myMax - 1 essentially dials this back a week. So, if your current week is 16, when you are filtering for last week you want the rows where WeekNum is 15.
Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!: Power BI Cookbook Third Edition (Color)
DAX is easy, CALCULATE makes DAX hard...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How would this work when last week is actually in last year?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks! I somehow managed to get the data right.
THX!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't worry.
I just realised how to work it out by myself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Timon,
Could you please share the way you do this visual? I'm new to Power BI and what I'm trying to do is to put two numbers in comparison on one single card and show the variance aside, which is just what you did.
Thank you!
Lexi
Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - January 2025
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
Subject | Author | Posted | |
---|---|---|---|
11-12-2024 12:17 PM | |||
11-07-2024 09:18 AM | |||
08-07-2024 12:40 PM | |||
08-01-2024 09:31 PM | |||
09-06-2024 08:55 AM |
User | Count |
---|---|
115 | |
76 | |
45 | |
44 | |
32 |
User | Count |
---|---|
172 | |
90 | |
66 | |
46 | |
45 |