Forum Discussion
Question regarding measure
HI Shamatix
Any chance you can post some sample data? Your explanation is good but it might help to provide a sample of data to work with.
- Shamatix8 years agoPost Partisan
Phil_Seamark wrote:HI Shamatix
Any chance you can post some sample data? Your explanation is good but it might help to provide a sample of data to work with.
Hey,
I have fast made a power bi report here https://uploadfiles.io/n80cv (Unsure where I could upload it)Anyways there is the 3 tables and a fast relationship table i need, well I have way more data but this is kind of the structure I have and I hope you get the larger idea of it all once you see those tables.
Feel free to ask me any questions needed be and Ill do my best to answer, you can also feel free to add me on skype: Snaske2 if it might be easier for you.
- Phil_Seamark8 years agoMicrosoft Employee
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
- Shamatix8 years agoPost Partisan
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
Wow you are good:) This is ALMOST what I wanted, I have tried to replicate your answer above, and I noticed two things.
Lets say there is 10 rows total for name 1, Amount has been changed a total of 4 times, then it currently says 0.40 if I aint format it, if I chose "show value as percent of row total" it says 57.14%, if I chose "show value as percent of column total" it says 100% , if I chose "show value as percent of grand total" it says 57.14% , however what I want is it to say 60%, because 60 of these 10 rows for this name wasnt changed, so 60% of the rows was correct, but I aint sure how I can achieve this.
I also noticed you use
var ConvertColonToSpace = SUBSTITUTE('Transfer (TableC)'[Message],":"," ")
And some of my columns in my real data does in fact have a space in the name sadly
So I changed your line into: var ConvertColonToSpace = SUBSTITUTE('Transfer (TableC)'[Message],":",":")
and it works now, however it says Amount: Kred: with a : in the name etc etc, is there anyways to avoid this or?
The last thing I noticed is the "Total column", is there any way I can get this total column to show the positiv % of the row (for each name)?
And how come there is blank values, for example in your screenshot it says Name1-Kred 100% but Name1 RestAmount is blank?
If nothing has changed at all it should be 100%:P
Best regards
And once again, the help is really appreciated :)