Forum Discussion
Measures
- 5 years ago
Hi Khaoula_Farissi - I am not sure I have the formula right, but you can change it. I modeled this properly, so bear with me as I explain.
First, I created a dimension table with just the brands A, B, C, and D. So the model looks like this:
Brand and BrandMonth1 are active, Brand and BrandMonth2 are inactive. That is why one is dotted vs solid.
Then I created 3 measures:
Vague Brand 1 = DIVIDE( COUNTROWS('Table'), COUNTROWS(ALL('Table')) ) -------------------------------------------------------------- Vague Brand 2 = CALCULATE( DIVIDE( COUNTROWS('Table'), COUNTROWS(ALL('Table')) ) , USERELATIONSHIP(Brand[Brand], 'Table'[BrandMonth2]) ) ------------------------------------------------------------- Vague Difference = [Vague Brand 1] - [Vague Brand 2]Vague Brand 1 counts the rows for each row in the table (so all A rows, then all B rows, etc.) and divides that by all of the rows in the table. That is the %.
Vague Brand 2 does the same thing, but this time it uses the Brand/Brand Month 2 relationship. USERELATIONSHIP turns on that inactive relationship and turns off the Brand/Brand Month 1 for this measure only.
The Vague Difference is simply the differnece between the 2 measures. The results:Here is my file so you can play with it as desired. If the math is wrong you can fix it or explain it better to me so I can assist.
Sorry for the misunderstanding
i want to calculate the count of every brand/total*100 this is how i do it in Excel:
count(BrandMonth1)/total(BrandMonth1)*100
count(BrandMonth2)/total(BrandMonth2)*100
i want to get :
- edhans5 years agoCommunity Champion
Hi Khaoula_Farissi - I am not sure I have the formula right, but you can change it. I modeled this properly, so bear with me as I explain.
First, I created a dimension table with just the brands A, B, C, and D. So the model looks like this:
Brand and BrandMonth1 are active, Brand and BrandMonth2 are inactive. That is why one is dotted vs solid.
Then I created 3 measures:
Vague Brand 1 = DIVIDE( COUNTROWS('Table'), COUNTROWS(ALL('Table')) ) -------------------------------------------------------------- Vague Brand 2 = CALCULATE( DIVIDE( COUNTROWS('Table'), COUNTROWS(ALL('Table')) ) , USERELATIONSHIP(Brand[Brand], 'Table'[BrandMonth2]) ) ------------------------------------------------------------- Vague Difference = [Vague Brand 1] - [Vague Brand 2]Vague Brand 1 counts the rows for each row in the table (so all A rows, then all B rows, etc.) and divides that by all of the rows in the table. That is the %.
Vague Brand 2 does the same thing, but this time it uses the Brand/Brand Month 2 relationship. USERELATIONSHIP turns on that inactive relationship and turns off the Brand/Brand Month 1 for this measure only.
The Vague Difference is simply the differnece between the 2 measures. The results:Here is my file so you can play with it as desired. If the math is wrong you can fix it or explain it better to me so I can assist.