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
Swamy3105
Helper IV
Helper IV

Calculate (sum) the Previous year Quarter's value?

Hi Experts,

 

Can you please help me on the below issue.

 

I have the data and i have the year details in the slicer. I have the logic for calculating the current year's Q1 value.

 

C_Q1 = CALCULATE(SUM(TEST_REPORT[Amount in local cur.]),FILTER(TEST_REPORT,TEST_REPORT[QTR]=1),FILTER(TEST_REPORT,TEST_REPORT[CY YEAR]=TEST_REPORT[Year]))
 
I want to calculate the last year's Q1 values. I have the logic but it's not working.
 
I do not have the date info in my table. I have the period details only, so I have grouped that as Q1, Q2 etc.,
 
Can anyone help me on this, please? 
1 ACCEPTED SOLUTION

I have found the solution, thanks Guys....

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Just remove the current filter on TEST_REPORT[CY Year] with the ALL function and set a new one to last year. In your logic, it should look like this:

 

C_Q1_LY =
CALCULATE(
                    SUM(TEST_REPORT[Amount in local cur.],

                    FILTER(

                               TEST_REPORT,

                               TEST_REPORT[QTR]=1
                               ),

                     FILTER(

                               ALL(TEST_REPORT[CY YEAR]);

                               TEST_REPORT[CY YEAR] = TEST_REPORT[YEAR] - 1

                               )
                     )

            

It's not working, I'm getting error..... 😞

 

Anonymous
Not applicable

Could you be a bit more specific? What error do you get?

I have found the solution, thanks Guys....

Hi @Swamy3105 ,

 

Can you share the solution? Thanks in advance.

 

 

Best Regards,

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

I just created the calendar table with DateKey and created the relationship with the main table.

 

Then i have created the Messure for the results.

 

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.

Top Solution Authors