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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Darrell
Frequent Visitor

Year over Year Data using Year / Month - Not showing totals

Thanks for looking!

I'm not getting any totals using a Calendar filter for YOY data.  The populated row data is correct, it's just not totaling.

 

NOTE: I haven't added a YOY column yet; this is just to get the previous data for that calculation.

 

I appreciate any insight.

 

Sales_Units = 
    CALCULATE (
        SUMX ( Sales_Receipts, Sales_Receipts[Unit_Sales] )
    )

 

Sales_Units_1Y = 

VAR CurrentYear = SELECTEDVALUE ( F_Calendar_Month[F_Year] )
VAR CurrentMonth = SELECTEDVALUE ( F_Calendar_Month[F_Month_Nbr] )

RETURN
    CALCULATE (
        SUMX ( Sales_Receipts, Sales_Receipts[Unit_Sales] ), 
        FILTER (
            ALL ( F_Calendar_Month ),
                F_Calendar_Month[F_Month_Nbr] = CurrentMonth &&
                F_Calendar_Month[F_Year] = CurrentYear - 1
        )
    )

 

Darrell_1-1660847115573.png

 

 

1 ACCEPTED SOLUTION
daXtreme
Solution Sage
Solution Sage

Sales_Units = SUM( Sales_Receipts[Unit_Sales] )

// This code is brittle because such transformations
// should use the id's of months, not separate fields
// like year and month number. But you have not shown your
// model, so I have to assume the minimum, meaning
// you don't have such a field in your date table.
Sales_Units_1Y = 
SUMX(
  SUMMARIZE(
    F_Calendar_Month,
    F_Calendar_Month[F_Year],
    F_Calendar_Month[F_Month_Nbr]
  ),
  var CurrentYear = F_Calendar_Month[F_Year]
  var CurrentMonth = F_Calendar_Month[F_Month_Nbr]
  var Result =
    CALCULATE(
      [Sales_Units],
      F_Calendar_Month[F_Year] = CurrentYear - 1,
      F_Calendar_Month[F_Year] = CurrentMonth,
      REMOVEFILTERS( F_Calendar_Month )
    )
  return
    Result
)

View solution in original post

2 REPLIES 2
daXtreme
Solution Sage
Solution Sage

Sales_Units = SUM( Sales_Receipts[Unit_Sales] )

// This code is brittle because such transformations
// should use the id's of months, not separate fields
// like year and month number. But you have not shown your
// model, so I have to assume the minimum, meaning
// you don't have such a field in your date table.
Sales_Units_1Y = 
SUMX(
  SUMMARIZE(
    F_Calendar_Month,
    F_Calendar_Month[F_Year],
    F_Calendar_Month[F_Month_Nbr]
  ),
  var CurrentYear = F_Calendar_Month[F_Year]
  var CurrentMonth = F_Calendar_Month[F_Month_Nbr]
  var Result =
    CALCULATE(
      [Sales_Units],
      F_Calendar_Month[F_Year] = CurrentYear - 1,
      F_Calendar_Month[F_Year] = CurrentMonth,
      REMOVEFILTERS( F_Calendar_Month )
    )
  return
    Result
)

I thought I posted a portion of the fiscal calendar table.  Sorry.  It looks like the attached.  I have a field called "F_YM" which I would consider the ID.

 

Darrell_0-1660870385427.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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