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 community ,
Est ce qu'il exciste une formule ou un moyen pour calculer une somme d'une valeur par semaine .
cordialement
Solved! Go to Solution.
Hi @Anonymous ,
We can try to use the following measure to meet your requirement:
TotalValueOfWeek =
VAR w =
WEEKNUM ( MIN ( 'Table'[Date] ) )
VAR y =
YEAR ( MIN ( 'Table'[Date] ) )
RETURN
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table' ),
WEEKNUM ( 'Table'[Date] ) = w
&& YEAR ( 'Table'[Date] ) = y
)
)
If it doesn't meet your requirement, Please show the exact expected result based on the Tables that we have shared.
Best regards,
Hi,
I have a similar case where I need to display for every product the sales of a specific period : 5 weeks since its first launch.
It's exactly the solution you gave :
Sales First 5 weeks =
VAR _WeekStart = [# First Week]
VAR _WeekEnd = [# Last Week]
RETURN CALCULATE( SUM(Fact_Sales[Sales]),
FILTER( Fact_Sales, Fact_Sales[Week Id] >= _WeekStart && Fact_Sales[Week Id] <= _WeekEnd)
)
It's working fine, except that when added on a grid, the grand total is not the sum of every single product's sales.
The filter is also applied to the total..
In other words, it calculates the total sales from the MIN week of ALL products, until the week calculated as MIN + 4 weeks.
Which is not the behavior I want.
For the grand total, I only need the sum of every single row.
Can anybody advise which can be the solution ?
Thanks
Hi @Anonymous ,
How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?
Best regards,
Hi @Anonymous ,
We can try to use the following measure to meet your requirement:
TotalValueOfWeek =
VAR w =
WEEKNUM ( MIN ( 'Table'[Date] ) )
VAR y =
YEAR ( MIN ( 'Table'[Date] ) )
RETURN
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table' ),
WEEKNUM ( 'Table'[Date] ) = w
&& YEAR ( 'Table'[Date] ) = y
)
)
If it doesn't meet your requirement, Please show the exact expected result based on the Tables that we have shared.
Best regards,
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 |