Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Trying to create a 3-period running total (current period & previous 2) where I am using custom periods (not dates). I can get it to work except I want the final value calculated to be the final period with values (in my example below I woud like the 2nd table to stop @ period '2022 - ON4')
I know I need to create an additional variable which calculates the final period & then put this as an IF statment at the beginning of the RETURN variable but just not sure of the formula
Thanks!!
=VAR Lastvisibleperiod =
MAX(Periods[Index])
VAR Firstvisibleperiod =
Lastvisibleperiod-2
VAR Result =
CALCULATE(
[IH - Sum of Sessions],
Periods[Index]>=Firstvisibleperiod,
Periods[Index]<=Lastvisibleperiod,
ALL(Periods)
)
RETURN
Result
Hi,
I am not sure how your datamodel looks like, but please try the below measure whether it suits your requirement.
New measure: =
VAR Lastvisibleperiod =
MAX ( Periods[Index] )
VAR Firstvisibleperiod = Lastvisibleperiod - 2
VAR Result =
CALCULATE (
[IH - Sum of Sessions],
Periods[Index] >= Firstvisibleperiod,
Periods[Index] <= Lastvisibleperiod,
ALL ( Periods )
)
RETURN
IF (
SELECTEDVALUE ( Periods[PeriodsName] ) = "2023-ON1"
|| SELECTEDVALUE ( Periods[PeriodsName] ) = "2023-ON2",
[IH - Sum of Sessions],
Result
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Thanks @Jihwan_Kim but I didn't want to hardcode in period names as this will change each time we update the datasource so basically I need the calculation to stop in the last period there is data for that period in the fact table. Is there a way to do this?
Hi,
Thank you for your feedback.
I think you can try to amend the logic something like below.
if the selected fiscal-year is the last fiscal year, then [IH - Sum of Sessions], otherwise, result.
Or, please share your sample pbix file's link here, and then I can try to look into it to come up with a more accurate solution.
Thank you.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
84 | |
83 | |
64 | |
61 | |
55 |
User | Count |
---|---|
171 | |
109 | |
109 | |
73 | |
71 |