cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

New Member

## How to measure the sum of X table (of this semester) / the sum of X table (of the last semester)

Hello and happy thanksgiving for you all,

I am having this issue with this tables and the formula should be:

But I was not able to had a proper calculation, since I am here:

Now, I have the semester as the column name "Año" where it shows as an integer the year and "Semester" that shows 1 and 2. Also, the "Matriculados" column is an integer.

I would be glad to know that there is a way to calculate the required formula.

1 ACCEPTED SOLUTION
Community Support

Hi @parisaranda ,

I build a sample to have a test. Firstly add a calculated column : Rank by Year and Semester.

``Rank by Year and Semester = RANKX('Table','Table'[Año]*10+'Table'[Semester],,ASC,Dense)``

Measure:

``````Sum of X table (of this semester) / Sum of X table (of the last semester) =
VAR _THIS_Semester =
CALCULATE ( SUM ( 'Table'[Matriculados] ) )
VAR _LAST_Semester =
CALCULATE (
FILTER (
ALL ( 'Table' ),
'Table'[Rank by Year and Semester]
= MAX ( 'Table'[Rank by Year and Semester] ) - 1
)
)
RETURN
DIVIDE ( _THIS_Semester, _LAST_Semester )``````

Result is as below.

Best Regards,
Rico Zhou

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

2 REPLIES 2
Community Support

Hi @parisaranda ,

I build a sample to have a test. Firstly add a calculated column : Rank by Year and Semester.

``Rank by Year and Semester = RANKX('Table','Table'[Año]*10+'Table'[Semester],,ASC,Dense)``

Measure:

``````Sum of X table (of this semester) / Sum of X table (of the last semester) =
VAR _THIS_Semester =
CALCULATE ( SUM ( 'Table'[Matriculados] ) )
VAR _LAST_Semester =
CALCULATE (
FILTER (
ALL ( 'Table' ),
'Table'[Rank by Year and Semester]
= MAX ( 'Table'[Rank by Year and Semester] ) - 1
)
)
RETURN
DIVIDE ( _THIS_Semester, _LAST_Semester )``````

Result is as below.

Best Regards,
Rico Zhou

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

Super User

could you pls provide the sample data and expected output?

Proud to be a Super User!

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

Top Solution Authors
Top Kudoed Authors