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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Anonymous
Not applicable

Dax Help

Hi Team,

 

Am trying to build a report that contain a table with several columns(include meassure also).

I have some slicers including date also.

Nazeez_0-1655469875611.png

The table is like above attached one.

I have a date slicer in canvas,so if select 2022 it should show 2022 values in  no of devices column and 2021 in last year no of devices column.

if select 2023 it should show 2023 values in  no of devices column and 2022 in last year no of devices column.

 

can any help me to write the dax for last year column

 

Regards,

Nadeem

2 ACCEPTED SOLUTIONS

@Anonymous 

pls  try this

Measure 2 = 
VAR _year=max('Table'[Year])-1
return CALCULATE(sum('Table'[Number Od Devices]),FILTER(ALLEXCEPT('Table','Table'[Account Name ]),'Table'[Year]=_year))

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

tamerj1
Community Champion
Community Champion

@Anonymous 
You mean something like this?

1.png

Number of Devises = SUM ( Data[Number Od Devices] )
Number of Devices Last Year = 
CALCULATE (
    [Number of Devises],
    Data[Year] = MAX ( Data[Year] ) - 1
)

View solution in original post

7 REPLIES 7
tamerj1
Community Champion
Community Champion

@Anonymous 
You mean something like this?

1.png

Number of Devises = SUM ( Data[Number Od Devices] )
Number of Devices Last Year = 
CALCULATE (
    [Number of Devises],
    Data[Year] = MAX ( Data[Year] ) - 1
)
tamerj1
Community Champion
Community Champion

Hi @Anonymous 

can you please provide sample data?

Anonymous
Not applicable

Hi @tamerj1 

 

Here is the sample data

 

Account Name Number Od DevicesMonthYear
AA175122021
BB169112021
CC15912022
DD25622022
EE25832022
FF12342022
AA23612022
BB3612022
AA5622022
BB36022022

@Anonymous 

pls  try this

Measure 2 = 
VAR _year=max('Table'[Year])-1
return CALCULATE(sum('Table'[Number Od Devices]),FILTER(ALLEXCEPT('Table','Table'[Account Name ]),'Table'[Year]=_year))

pls see the attachment below





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Anonymous
Not applicable

Thanks @tamerj1 

Anonymous
Not applicable

Thanks @ryan_mayu 

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.