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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

How to use this table to do desired visualizations and computations?

Hi!

 

Doing some transformations, I got the following table in the Power Query Editor:

table_example.png

 

Now, I am asked to create visualizations that include all measures in the data over time and to do  Year-over-year calculations for all the measures.

 

 

I am not sure how to do both tasks.

 

For example, how could I use the table to do the year-over-year calculations for all the measures? I tend to use the DAX-Funtion SAMEPERIODLASTYEAR by creating a Measure, but don't know how to do that here (cannot use SUM or something like that over the Value column...).

 

 

1 ACCEPTED SOLUTION
v-yadongf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please add an index column in Power Query:

vyadongfmsft_0-1664519336432.png

 

Please try following DAX:

YOY = 
var cur_wert = 'Table'[Wert]
var pre_wert = CALCULATE(
    MAX('Table'[Wert]),FILTER('Table','Table'[Index] = EARLIER('Table'[Index]) -1 && 'Table'[Measure] = EARLIER('Table'[Measure]))
    )
return
DIVIDE(cur_wert - pre_wert,pre_wert)

vyadongfmsft_1-1664519470014.png

Year-over-year calculations for all the measures:

vyadongfmsft_2-1664519553570.png

Best regards,

Yadong Fang

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

View solution in original post

3 REPLIES 3
v-yadongf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please add an index column in Power Query:

vyadongfmsft_0-1664519336432.png

 

Please try following DAX:

YOY = 
var cur_wert = 'Table'[Wert]
var pre_wert = CALCULATE(
    MAX('Table'[Wert]),FILTER('Table','Table'[Index] = EARLIER('Table'[Index]) -1 && 'Table'[Measure] = EARLIER('Table'[Measure]))
    )
return
DIVIDE(cur_wert - pre_wert,pre_wert)

vyadongfmsft_1-1664519470014.png

Year-over-year calculations for all the measures:

vyadongfmsft_2-1664519553570.png

Best regards,

Yadong Fang

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

VijayP
Super User
Super User

@Anonymous 

selected year - calculate(sum(wert),measure="Revenue")
you must have date table

Previous year - calculate(selected year,sameperiodlastyear(datedim[date))

like wise create all measures




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Anonymous
Not applicable

Hi! @VijayP 

i am not sure that I do understand you correctly.

 

You suppose to create a measure 

 

selected year = calculate(sum(wert),measure="Revenue")

 

but this sums the entries of the column wert for all years and for Revenues...

 

Is this what it is supposed to be?

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors