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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

How to deal with monthly data with multiple attributes

Hi guys,
I have several metrics that are updated monthly, but each metric has several attributes (owner, scope, data provider, etc.) Here's an example of a metric.

Metric: Stations Upgraded
Scope: Budget
Owner: Bill Blocks
Data Provider: Jesse James

MonthActualGoalBaseline
Jan15155
Feb18205
Mar24255
Apr31305

 

I want to plot Actual and Goal and Baseline with Month in the x-Axis and the values in the y-axis. I also need to put all the metrics in one table and show the values. And I need to use slicers to sort by scope, owner, etc.


My problem is I can't find a suitable way to transform the data so I can use it. I initially tried making the metrics be columns and month be rows, but I wasn't able to sort by the other attributes. Then I tried making the month the columns and the metrics the rows, but not every metric has the same units (%, $, dec, etc.) and I couldn't change the data type by row. I decided to make every metric its own table, which works but it has SIGNIFICANTLY slowed down my computer (as I have over 20 metrics to track). Is there any way that I can deal with this data? If I could do something like data type by row, or do a relationship between column and row it would work. I'm open to any solutions and perhaps I have overlooked a very simple one. I really appreciate the help!

Thank you!

1 ACCEPTED SOLUTION

You can solve this by using a switch and format function

* In the measures you probably have to change ";" to "," depending on the region you are working in

2020-04-23_22-02-06.jpg

 

 

View solution in original post

9 REPLIES 9
Wimverh
Resolver IV
Resolver IV

Create a metrics table: 

MetricScopeOwnerBudget
Stations UpgradeBudgetBillJesse
My second metricBudgetDonaldJesse

 

Add a column metric to your other table

DateMetricActualGoalBaseline
1/1/2020Stations Upgrade15155

 

Create a relation 1 to Many between the metric table and your data table.

Anonymous
Not applicable

thanks @Wimverh ,
If I do this, will I be able to select the data type for each metric? Metrics are not necesarily the same data type, some are % and others deciamls or currencies.

You can solve this by using a switch and format function

* In the measures you probably have to change ";" to "," depending on the region you are working in

2020-04-23_22-02-06.jpg

 

 

Anonymous
Not applicable

@Wimverh ,
I'm having trouble getting the final values to format correctly. It feels like I'm doing something wrong with the FORMAT function. For example, I'm not getting any "%" sign when using "Percent" format, but I am getting more digits to the right of the decimal point.
2020-04-27 17-37-21_Start.png

I checked that the relationship is correct (1:many) from the Metric to MetricValues table (single) and that the format code is numerical. Not sure what else to do, but this seems to be going in the right direction of solving my issue.

What results do you get one you create this measure, and add it in a table:

Testformatting = 
var myvalue = 0.05
var minswitch=2
return
SWITCH(minswitch,
1,FORMAT(myvalue,"Currency"),
2,FORMAT(myvalue,"Percent")
)

It should return 5.00 % when the variable minswitch = 2
when you change the variable to 1, then you should have as result 0.05 $ (depending on your regional settings) 

 

If the above code doesn't help you, I'll need a power bi file (please clear all sensitive data).

Anonymous
Not applicable

@Wimverh ,
I tried adding the format code to the same table as the values, and using the switch formula on that and it worked. It looks like the issue lies on the relationship, but I don't know why it wasn't working. I made sure the columns for the relationship had the same values. At any rate, this solved my issue. Thank you very much!

parry2k
Super User
Super User

@Anonymous underline problem is the structure of your data, you need to unpivot it, follow these steps:

 

- click transform data

- select month column, right-click and select unpivot other columns

- it will add two-column, attribute and value, rename column name as you like 

 

close and apply, pick any visual, let's say line graph

 

- drop month on x-axis

- drop attribute on legend

- drop value on value section

 

and you will have what you are looking for.

 

----

I would 💖 Kudos 🙂 if my solution helped. If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Thank you @parry2k ,
I have tried something like this before, but I couldn't it get it to work. Can you clarify what the table should look like before performing the unpivot? Thank you

@Anonymous the output will look something like this

 

Month Attribute Value
Jan Actual 15
Jan Baseline 15
Jan Goal 5
Feb Actual 18
Feb Baseline 20
Feb Goal 5
     


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Users online (4,036)