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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

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.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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