Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
lefinalzugzwang
Frequent Visitor

calculating the number of periods in which a budget was exceeded

Hi,

I am aiming to create a measure to calculate the number of periods in which a budget was exceeded.

In my specific case, what I am trying to do is count the number of Dates[Iso.Week] in which Sales[Sale.Value] for Dates[Iso.Year]=2019 exceeded Sales.[Sale.Value] for Dates[Iso.Year]=2018.

Any help would be greatly appreciated, I think I am really struggling to wrap my head around filter contexts ...

Best wishes,
Laurence
_____

p.s.
Dates[Iso.Year] is the Year as defined by week numbers
Dates[Iso.Week] is the week number of a given date
Sales[Sale.Value] is the raw sales value for transactions (which are all dated and linked to the above two fields).

2 REPLIES 2
v-yuta-msft
Community Support
Community Support

@lefinalzugzwang,

 




I am aiming to create a measure to calculate the number of periods in which a budget was exceeded.

In my specific case, what I am trying to do is count the number of Dates[Iso.Week] in which Sales[Sale.Value] for Dates[Iso.Year]=2019 exceeded Sales.[Sale.Value] for Dates[Iso.Year]=2018.

Any help would be greatly appreciated, I think I am really struggling to wrap my head around filter contexts ...

Best wishes,
Laurence
_____

p.s.
Dates[Iso.Year] is the Year as defined by week numbers
Dates[Iso.Week] is the week number of a given date
Sales[Sale.Value] is the raw sales value for transactions (which are all dated and linked to the above two fields).


Could you share some sample data and clarify more details about your current measures and expected result?

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Jimmy, sure ...

For example

Dates[Iso.Week]=1, Sales[Sale.Value] for Dates[Iso.Year] 2018 = £0.21M, Sales[Sale.Value] for Dates[Iso.Year] 2019 = blank       -False

Dates[Iso.Week]=2, Sales[Sale.Value] for Dates[Iso.Year] 2018 = £0.54M, Sales[Sale.Value] for Dates[Iso.Year] 2019 = £0.73M    -True

Dates[Iso.Week]=3, Sales[Sale.Value] for Dates[Iso.Year] 2018 = £0.26M, Sales[Sale.Value] for Dates[Iso.Year] 2019 = £0.44M    -True

Dates[Iso.Week]=4, Sales[Sale.Value] for Dates[Iso.Year] 2018 = £0.70M, Sales[Sale.Value] for Dates[Iso.Year] 2019 = £0.82M    -True

Dates[Iso.Week]=5, Sales[Sale.Value] for Dates[Iso.Year] 2018 = £0.55M, Sales[Sale.Value] for Dates[Iso.Year] 2019 = £0.54M    -False

Measure = number of weeks so far this year where 2019 exceeded 2018 = 3

 

Hope this makes things clearer.

Best wishes,
Laurence

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.