I have been trying to create a graph where i need to put the percentage value based on the calculation being performed.
Input Data:
<table> <tr> <th>S.No</th> <th>Category</th> <th>Terms</th> <th>Location</th> <th>Value</th> </tr> <tr> <td>1</td> <td>Economic Times</td> <td>Basic Debt</td> <td>India</td> <td>215000</td> </tr> <tr> <td>2</td> <td>Economic Times</td> <td>Basic Credit</td> <td>India</td> <td>150000</td> </tr> <tr> <td>3</td> <td>TOI</td> <td>Basic Credit</td> <td>India</td> <td>35617</td> </tr> <tr> <td>3</td> <td>TOI</td> <td>Basic Debt</td> <td>India</td> <td>85877</td> </tr> <tr> <td>4</td> <td>Mint Today</td> <td>Basic Surplus</td> <td>India</td> <td>176500</td> </tr> <tr> <td>5</td> <td>Mint Today</td> <td>Basic Debt</td> <td>India</td> <td>387200</td> </tr> <tr> <td>6</td> <td>Mint Today</td> <td>Basic Credit</td> <td>India</td> <td>215900</td> </tr> <tr> <td>7</td> <td>BBC</td> <td>Basic Surplus</td> <td>India</td> <td>18775</td> </tr> <tr> <td>8</td> <td>BBC</td> <td>Basic Debt</td> <td>India</td> <td>195000</td> </tr> <tr> <td>9</td> <td>BBC</td> <td>Basic Credit</td> <td>India</td> <td>174220</td> </tr> </table>
For Eg: Need to pick Each category based on it we need to find percentage using (Basic Debt Value/Basic Credit Value)*100
For Economic Times we have 69.76%
We need to plot it on the Secondary Y Axis.
How we can perform the calculation in power BI and plot the line graph using the calculated percentage, Need suggestion how we can perform it or create a query
try this:
Debt / Credit =
VAR _debt =
CALCULATE (
SUM ( 'Table'[Value] ),
ALLEXCEPT ( 'Table', 'Table'[Category ] ),
'Table'[Terms ] = "Basic Debt"
)
VAR _credit =
CALCULATE (
SUM ( 'Table'[Value] ),
ALLEXCEPT ( 'Table', 'Table'[Category ] ),
'Table'[Terms ] = "Basic Credit"
)
RETURN
_debt / _credit
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.