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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Help please! Operating with values in one column (for different months)

Hi Community!

 

I'm new here, and I would very much appreciate if you can help me with this (probably simple) situation.

I have a table that looks like this:

 

gperezt_1-1659309086513.png

 

And I need to show a visualization like this one:

 

gperezt_2-1659309233206.png

 

Without creating another table that transposes the data, is there a way to calculate the fields in the second table using DAX?

I´ll make sure to thank with points the solving solution and even post a thank you note in LinkedIn.

Thank you all in advance,

Best regards!

 

 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 
Here is a sample file with the solution https://we.tl/t-209bVq49gJ

 

Salaies = 
VAR CurrentValue = SUM ( Payroll[salary] )
VAR MinDate = CALCULATE ( MIN ( Payroll[dim_time] ), ALLSELECTED ( Payroll ) )
VAR MaxDate = CALCULATE ( MAX ( Payroll[dim_time] ), ALLSELECTED ( Payroll ) )
VAR FirstValue = CALCULATE ( SUM ( Payroll[salary] ), Payroll[dim_time] = MinDate )
VAR LastValue = CALCULATE ( SUM ( Payroll[salary] ), Payroll[dim_time] = MaxDate )
RETURN
    IF (
        HASONEVALUE ( Payroll[dim_time] ),
        CurrentValue,
        FORMAT ( DIVIDE ( LastValue - FirstValue, FirstValue ), "Percent" )
    )

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@tamerj1 Thank you very very much!! It worked perfectly! 

I can´t believe you even sent me a sample file with the solution.

I appreciate it.

Best regards!

tamerj1
Super User
Super User

Hi @Anonymous 
Here is a sample file with the solution https://we.tl/t-209bVq49gJ

 

Salaies = 
VAR CurrentValue = SUM ( Payroll[salary] )
VAR MinDate = CALCULATE ( MIN ( Payroll[dim_time] ), ALLSELECTED ( Payroll ) )
VAR MaxDate = CALCULATE ( MAX ( Payroll[dim_time] ), ALLSELECTED ( Payroll ) )
VAR FirstValue = CALCULATE ( SUM ( Payroll[salary] ), Payroll[dim_time] = MinDate )
VAR LastValue = CALCULATE ( SUM ( Payroll[salary] ), Payroll[dim_time] = MaxDate )
RETURN
    IF (
        HASONEVALUE ( Payroll[dim_time] ),
        CurrentValue,
        FORMAT ( DIVIDE ( LastValue - FirstValue, FirstValue ), "Percent" )
    )

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.