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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
LindaHa
Helper I
Helper I

Per 1000 per month

Hello,
 
I am trying something simular. I have a list with classifications but I need those per month per 1000 sectors . The per month separation works fine but I do not know how to get in the per 1000. In Excel I was able to do it with = (number of classification)*1000/(real number of sectors) but when I use this in BI the result is empty.
 
 In fact I want to show my amount of classification per month per 1000 sectors in a graph.
 
Thanks for any assistance.
 

12 REPLIES 12
AlexChen
Employee
Employee

Hi,

 

I assume your first table called “accident” and the second table called “flights”.

 

I changed the records in these 2 table in order to give an example.

 

1.png

 

2.png

 

First,  You need to build a relationship between accident[month] and flights[Month].

 

Now You can add a calculated column to calculate the value:

 

Column = DIVIDE(CALCULATE(COUNTA(accident[classification]), RELATEDTABLE(accident)) * 1000, [TTL])

 

This is the result:

 

 

3.png

 

Best Regards

Alex

 

Hi Alex,

 

thanks for this! Could you please explain to me why I have to add an ID?

 

Thanks Linda

Hi LindaHa,

 

I add an ID just to give a example to show the records clearly. You don't have to add it.

 

Best Regards

Alex

 

 

Hi Alex,

 

I think I got a little closer to my goal with your assistance. Thank you very much. Unfortunately I did not get the result per month per classification. It is all the same for classification 😕

Do you have a tip for me how I can split it for the classifications so that they do not have all the same value?Unbenannt.PNG

 

Best regards Linda

Hi,

 

You can create a table to get classification per month.

 

monthlyClassInfo = SUMMARIZE(accident, accident[month], accident[classification], "count of classification", COUNTA(accident[classification]))

 

1.png

 

Create relationship for monthlyClassInfo[month] and flights[month].

 

3.png

 

Now you can add a column in monthlyClassInfo to calculate per classification per month.

 

Column = DIVIDE([count of classification] * 1000, RELATED(flights[TTL]))

 

2.png

 

Best Regards

Alex

Hi Alex,

 

thanks for your tip. When I try: monthlyClassInfo = SUMMARIZE(accident, accident[month], accident[classification], "count of classification", COUNTA(accident[classification]))

 

It says: "Function SUMMARIZE expects a column name as argument number 5" when I try to add COUNTA

 

Best regards Linda

Hi LindaHa,

 

I can't reproduce your error. It works fine in my local. The "CountA" should be there.

 

I advise you take a look at this article https://msdn.microsoft.com/en-us/library/gg492171.aspx

to see the syntax of SUMMARIZ and check you code again.

 

Please also make sure you are using the latest Powerbi desktop.

 

Best Regards

Alex

Hi AlexChen,

 

I think my issue is that the Count of classification is not a calculated column. Can you tell me how I can make it. For me it only works as a measure.

 

Thanks Linda

Hi Linda,

 

You can create 2 measures for "accident" table.

 

countOfClassification = COUNTAX(accident, accident[classification])

 

measureRate = SUMX(accident, DIVIDE(accident[countOfClassification] * 1000, RELATED(flights[TTL])))

 

This is the result:

 

1.png

 

Best Regards

Alex

Greg_Deckler
Super User
Super User

Can you provide some sample data?


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

This is my graph. I need exactly this but not with absolute numbers but with "amount of classification per month per ttl flights".

 

 

current graphcurrent graphRaw dataRaw dataper sector valuesper sector values

so the x-axis should not be the real numbers but the "classification per 1000 flights".

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.