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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Jtbonner1986
Frequent Visitor

How to calculate for next year without using year in table display

Hi

 

I am bing really silly here, but i want to create a DAX measure to calcualte demand for 'next year' and 'next year +1' etc without using the field 'year' in the table visual. 

 

The suporting table is structured like the below

MaterialSales DateTotal
A01/01/202310
A01/01/202410
A01/01/202510
A05/01/202310

 

 

the output i desire is like the below (and i want to create this without hardcoding the year in the measure) 

 

MaterialNext Year Sales (2024)Next Year +1 Sales (2025)
A  
B  

 

So i currently use something like this:

Calcaulate(Sum(Material[total]),Calendar_Table[year] = "2024"))

 

but i want to avoid this for future proofing the report 

 

Cheers

1 ACCEPTED SOLUTION
ChiragGarg2512
Super User
Super User

@Jtbonner1986 , Use this dax measure formula:

Next Year Sales (2024) = Calcaulate(Sum(Material[total]),Calendar_Table[year] = Year(Today()) + 1)) 

 

and +2 for next year +1

 

Thank You

View solution in original post

2 REPLIES 2
some_bih
Super User
Super User

Hi @Jtbonner1986 

In Calendar / Date table create calculated column NextTwoYears, with True False values.

In your measure, CALCULATE part should look like below (adjust your Calendar / Date table name)

Calculate(Sum(Material[total]), <YourTable>[NextTwoYears]="True"

 

NextTwoYears =
VAR __current_year =
    YEAR ( TODAY () )
VAR __next_year = __current_year + 1
VAR __two_years = __current_year + 2
VAR __Result =
    IF (
        YEAR ( 'Date'[Date] ) = __next_year,
        TRUE (),
        IF ( YEAR ( 'Date'[Date] ) = __two_years, TRUE (), FALSE () )
    )
RETURN
    __Result
 

Did I answer your question? Kudos appreciated / accept solution!





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

Proud to be a Super User!






ChiragGarg2512
Super User
Super User

@Jtbonner1986 , Use this dax measure formula:

Next Year Sales (2024) = Calcaulate(Sum(Material[total]),Calendar_Table[year] = Year(Today()) + 1)) 

 

and +2 for next year +1

 

Thank You

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.