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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Ratio between categories MtD, YtD

Hi,

 

I have som time series data:

Udklip1.PNG

 

that i would like to present in a table like this:

 

Udklip.PNG

I can construct the MonthToDate measures:

MonthToDate = sum(Timeseries[Value])-Calculate(sum(Timeseries[Value]);LastDate(PREVIOUSMONTH('Timeseries'[Date])))

 

and i can also calculate the ratio as maeasure.

 
Ratio = Calculate(sum(Timeseries[Value]);Timeseries[Category]="TS1")/calculate(sum(Timeseries[Value]);Timeseries[Category]="TS2")
 
But I can not figure out how to put it all in one table like the one above. Do I have to manipulate the data in an earlier step or is there a better way to do this?
 
Best Regards,
Hans
2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

How have you arrived at the numbers in each of the 3 numeric columns?  What is the underlying logic?  Share some dataset that can be pasted in an Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-lili6-msft
Community Support
Community Support

HI, @Anonymous 

Based on my research, you could try this way as below:

Step1:

Add a Category dim table

 

categories = UNION(Values(Example[Category]), ROW("Category","Ratio TS1/Ts2"))

Step2:

 

Create the relationship between Category dim table and basic table by Category column

Step3:

Add measre like this 

 

Measure = IF(SELECTEDVALUE(categories[Category])="Ratio TS1/Ts2",[Ratio],CALCULATE(SUM(Example[Value])))

Then drag Category from Category dim table in to visual

 

Best Regards,
Lin

 

 

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

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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