Forum Discussion
Question regarding measure
Hi Shamatix
I got your sample model and here is what I've got so far.
I added a calcuated column to your TableC using the following code :
Column Name =
var ConvertColonToSpace = SUBSTITUTE('Transfer (TableC)'[Message],":"," ")
var FirstSpace = FIND(" ",ConvertColonToSpace,1,0)
return LEFT(ConvertColonToSpace,FirstSpace)
This gave me a field that I could drag to the Column of the matrix visual
I then created the following calculated measure
Count of rows in Table B = CALCULATE(
COUNTROWS('Data (TableB)') ,
ALLEXCEPT('Cred (TableA)','Cred (TableA)'[Name])
)Which will give me the overall total of rows in TableB for each Name - which I will use in my final calculated measure :
Measure = DIVIDE(
COUNTROWS('Transfer (TableC)'),
'Data (TableB)'[Count of rows in Table B]
)If you create that measure (use a better name) on the model you uploaded, and format as percentage, I got the following result
Phil_Seamark wrote:Hi Shamatix
I got your sample model and here is what I've got so far.
I added a calcuated column to your TableC using the following code :
Column Name =
var ConvertColonToSpace = SUBSTITUTE('Transfer (TableC)'[Message],":"," ")
var FirstSpace = FIND(" ",ConvertColonToSpace,1,0)
return LEFT(ConvertColonToSpace,FirstSpace)This gave me a field that I could drag to the Column of the matrix visual
I then created the following calculated measure
Count of rows in Table B = CALCULATE( COUNTROWS('Data (TableB)') , ALLEXCEPT('Cred (TableA)','Cred (TableA)'[Name]) )Which will give me the overall total of rows in TableB for each Name - which I will use in my final calculated measure :
Measure = DIVIDE( COUNTROWS('Transfer (TableC)'), 'Data (TableB)'[Count of rows in Table B] )If you create that measure (use a better name) on the model you uploaded, and format as percentage, I got the following result
Also in need of a column that counts how many rows there if for each "Name" in table B if possible:D
- v-ljerr-msft8 years agoMicrosoft Employee
Hi Shamatix,
1. Lets say there exsist 10 rows in TableB with the value "Name1", 4 of the rows has changed amount which can be seen in TableC, now I get the result 0,40, if I put on "Show value as percent of grand total" it says 57.14%, if I choose "Show value as percentof row total" it says 57.14% and if I choose "Show value as percent of column total" it says 100%, but the result I want is 60%, because 4 out of 10 time the Amount has changed for Name1, therefor the value has been correct 60% of the time, so I want it to return 60%.
2. How come there is blank values? 100% should mean that the value has NEVER been changed for this "Name" and 0% should mean it has been changed ALL the times.
Try using the formula below to create the measure.
Measure = 1 - DIVIDE( COUNTROWS('Transfer (TableC)'), 'Data (TableB)'[Count of rows in Table B] )3. I noticed your line:
var ConvertColonToSpace = SUBSTITUTE('Transfer (TableC)'[Message],":"," ")var FirstSpace = FIND(" ",ConvertColonToSpace,1,0)
And I use space in some of my column names in the real data, so what I did was change it to the following:var ConvertColonToSpace = SUBSTITUTE('Transfer (TableC)'[Message],":",":")
var FirstSpace = FIND(":",ConvertColonToSpace,1,0)
Now it results in Name: Amount: Rest Amount: Inv Date: etc etc etc, is there anyways to get rid of the : in the column names but still get the space?
Try using the formula below to create the column.
Column Name = var firstColon = FIND(":",'Transfer (TableC)'[Message],1,0) return LEFT('Transfer (TableC)'[Message],firstColon-1)Also in need of a column that counts how many rows there if for each "Name" in table B if possible:D
You should be able to use the formula below to create a calculate column in table b to counts how many rows there for each "Name".
Count of Names in Table B = CALCULATE( COUNTROWS('Data (TableB)') , ALLEXCEPT('Data (TableB)','Data (TableB)'[Name]) )Here is the modified pbix for your reference. :smileyhappy:
Regards
- Shamatix8 years agoPost Partisan
v-ljerr-msft wrote:Hi Shamatix,
1. Lets say there exsist 10 rows in TableB with the value "Name1", 4 of the rows has changed amount which can be seen in TableC, now I get the result 0,40, if I put on "Show value as percent of grand total" it says 57.14%, if I choose "Show value as percentof row total" it says 57.14% and if I choose "Show value as percent of column total" it says 100%, but the result I want is 60%, because 4 out of 10 time the Amount has changed for Name1, therefor the value has been correct 60% of the time, so I want it to return 60%.
2. How come there is blank values? 100% should mean that the value has NEVER been changed for this "Name" and 0% should mean it has been changed ALL the times.
Try using the formula below to create the measure.
Measure = 1 - DIVIDE( COUNTROWS('Transfer (TableC)'), 'Data (TableB)'[Count of rows in Table B] )3. I noticed your line:
var ConvertColonToSpace = SUBSTITUTE('Transfer (TableC)'[Message],":"," ")var FirstSpace = FIND(" ",ConvertColonToSpace,1,0)
And I use space in some of my column names in the real data, so what I did was change it to the following:var ConvertColonToSpace = SUBSTITUTE('Transfer (TableC)'[Message],":",":")
var FirstSpace = FIND(":",ConvertColonToSpace,1,0)
Now it results in Name: Amount: Rest Amount: Inv Date: etc etc etc, is there anyways to get rid of the : in the column names but still get the space?
Try using the formula below to create the column.
Column Name = var firstColon = FIND(":",'Transfer (TableC)'[Message],1,0) return LEFT('Transfer (TableC)'[Message],firstColon-1)Also in need of a column that counts how many rows there if for each "Name" in table B if possible:D
You should be able to use the formula below to create a calculate column in table b to counts how many rows there for each "Name".
Count of Names in Table B = CALCULATE( COUNTROWS('Data (TableB)') , ALLEXCEPT('Data (TableB)','Data (TableB)'[Name]) )Here is the modified pbix for your reference. :smileyhappy:
Regards
Hey,
Thanks a ton for the answer, however I still encounter two problems, and they go as follows:On the below picture you can see I have dragged in "Count of names in Table B" in the columns but there come no new column?
I basicly want a column to the furthest right, telling me how many rows exsist for NameA in Data(B), how many rows exsists for Name2 etc etc

Also I am still unsure how you got everything to be in Percentage, where do you do this?
- Shamatix8 years agoPost Partisan
Nevermind I figured out the percentage, but I still havnt figured out the count pr names from data table, how to get it in.