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

I want to calculate the highest difference of categories between two month

Hello I have a data as below,
Created xx months ago is a calculated column which changes it value dynamically as the months changes , as this is the June month going on therefore 
1 - May , 2 - April
Please note I have created month as 3 ,4,5 as well but i want it for 1 and 2

CategoryTotal hrs.Created xx months ago
A201
B501
C301
D15

 

1

E751
A802
B302
C752
D302
E252

 

I want to have a calculated pivot table as below

CategoryCreated xx months ago - 1Created xx months ago- 2

Difference

 

A208060
B503020
C307545
D153015
E2525

0

The difference value should be sorted in decreasing order and then 

Now after the difference in calculated and sorted i want to find the rank 1 , rank2 and rank3 category with the decrease/increase percentage

For example - Rank1 - Category A - percentage = 75%

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

It will be a lot easier to solve this problem if you have a Date column.  If you have that column, then share the revised input data.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hello @Ashish_Mathur , yes it does have a date column

CategoryTotal hrs.Created xx months agodate
A2015/13/2024
B5015/10/2024
C3015/14/2024
D15

 

1

5/26/2024

E7515/3/2024
A8024/9/2024
B3024/24/2024
C7524/16/2024
D3024/10/2024
E2524/4/2024



Please note - created xx months ago is the dynamic changing value as this is june month therefore 1 represents may month and 2 represents april month. 
Dax used - 

Created xx Months Ago = DATEDIFF('Test'[Date_time],TODAY(),MONTH)

 

I want to have a pivot table , and a dax query to calculate rank1, rank2, rank3 categories 

Anonymous
Not applicable

Hi @Anonymous,

It sounds like you wanted to calculate based on the calculated column which will be change when data updated.

For this scenario, I'd l like to suggest you use Dax expression to get the max and min value from that field based on current category group and stored in the variables.

Then you can use the current category and variable as condition to find out the value, calculate the difference, and write a new measure based on the current difference value to get the rank.

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Hello, can you suggest a dax query for it please

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.