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.
Hi,
I need your help on getting the sum of specific week start and week end. I tried running total but it's not the expected result.
My chart should look like this whether in table or bar chart:
It's easy to do this in Excel but could not get it correctly in PowerBI. Please refer to the details below:
Here's the link of sample pbix.
https://drive.google.com/file/d/1KRJfdfqbV88I1Y5eKE2eCvwZSMunhtdr/view?usp=sharing
Thanks in advance for your help and sharing your knowledge.
Solved! Go to Solution.
@summer18 - Seems like this should be:
Measure =
VAR __WeekMax = MAX('Table'[Week])
VAR __WeekMin = __WeekMax - 6
VAR __Table = FILTER(ALL('Table'),[Week] >= __WeekMin && [Week] <= __WeekMax)
RETURN
IF(__WeekMin <= 0,BLANK(),SUMX(__Table,[Expenses]))
@summer18
The PBIX file link requires a google sign-in open - please change settings in google to allow anyone with the link to download.
This way - we can use your underlying table design to help you.
@summer18 - Seems like this should be:
Measure =
VAR __WeekMax = MAX('Table'[Week])
VAR __WeekMin = __WeekMax - 6
VAR __Table = FILTER(ALL('Table'),[Week] >= __WeekMin && [Week] <= __WeekMax)
RETURN
IF(__WeekMin <= 0,BLANK(),SUMX(__Table,[Expenses]))
Hi @Greg_Deckler ,
Thanks for your help. Your formula worked on my issue. I just added Year in the formula so that the calculation will still be in the same year
Measure =
VAR __WeekMax = MAX('Table'[Week])
VAR __WeekMin = __WeekMax - 6
VAR __Table = FILTER(ALL('Table'),
'Table'[Year] = MAX( 'Table'[Year]) &&
[Week] >= __WeekMin && [Week] <= __WeekMax)
RETURN
IF(__WeekMin <= 0,BLANK(),SUMX(__Table,[Expenses]))
@summer18 - Awesome! Glad to hear it. Yes, good call on the year!
@summer18 , refer if my blog on week can help. You can create a week year table if you do not have date. and use that.
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
Week of choice -https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Powe...
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
95 | |
76 | |
65 | |
51 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |