How to Calculate measurement %sale Proportion in PowerBI - powerbi

I'm newbie in PowerBI user.I create simple sale report and measurement. Like This :
My problem.In PowerBI show % calculate only Net sale and total rows but I need all % sale result like this :
Please suggest me how to solve this problem.This's my Code.
% to Sales = round(DIVIDE(
sum(DAILY_PNL_FF_TH_V2[VALUE]),
CALCULATE(sum(DAILY_PNL_FF_TH_V2[VALUE]),FILTER(ALLSELECTED(ERP_ACCOUNT[group_1]),ERP_ACCOUNT[group_1]="Net Sales")
))*100,2) &"%"

If you are trying to get the Percent of each group relative to Net Sales, then you can try something like below:
% to Sales =
VAR netSalesAmount =
CALCULATE (
SUM ( DAILY_PNL_FF_TH_V2[VALUE] ),
ERP_ACCOUNT[group_1] = "Net Sales"
)
RETURN
DIVIDE ( SUM ( DAILY_PNL_FF_TH_V2[VALUE] ), netSalesAmount )
Also, it is better to address formatting in the screen below so that the number is treated as a number rather than text. This is both for sorting and exporting the data. Also, it keeps the calculation simpler:

Related

Cumulative running total based on count PowerBI measure

I'm trying to create a chart with 3 informations:
Total cases
% of total per day
cumulative % running total
The first two informations are working, but I can't make the third one work, my chart look like this
And I need it to look like this
Basically, the upper line is a cumulative sum of the lower line, the problem is that the values of the bars are just a count on my table and the lower line I made using the PowerBI function "Show as % of total"
I've tried googling but no luck with this one, tried this measure but didn't work:
Running Total MEASURE =
CALCULATE (
COUNT ( 'Primes Encerrados'[Nome Cliente] ),
FILTER (
ALL ( 'Primes Encerrados' ),
'Primes Encerrados'[Data] <= MAX ( 'Primes Encerrados'[Data] )
)
)
Use a the Quick Measure feature to get your running total formula:
Power BI will generate this formula for you:
Primes encerrados running total in Dias =
CALCULATE(
SUM('Geral'[Primes encerrados]),
FILTER(
ALLSELECTED('Geral'[Dias]),
ISONORAFTER('Geral'[Dias], MAX('Geral'[Dias]), DESC)
)
)
Add the measure to your chart and show it as % of Grand Total like you did with the first line

POWER BI Measure for dividing total sales by each person by total sales

I have made an measure for showing total sales by each person. I can't figure how to make an measure for dividing total sales by each person BY total sales. For example, for the person "bmo" I want to calculate 303/3153 and so on.
I have tried using the same measure as I use on "Totalt antall salg" and use the Show value as, but that just shows the correct value, and does not calculate it, and I need to use the number for later.
You can ignore filter context by using ALL to get total sales:
VAR _TotalSales =
CALCULATE (
COUNTROWS ( 'KasseJournal' ),
FILTER ( ALL ( 'KasseJournal' ),
'KasseJournal'[Hendelse] = "Bekreftet kasseekspedisjon"
)
)
RETURN DIVIDE ( [Totalt antall salg], _TotalSales, 0 )

How to calculate average percentage in PowerBI?

Hi everyone,
I'm still new to PowerBI, right now I have a set of data in PowerBI as shown in the screenshot above. I have a Measure to calculate the % of OK:
total_student = COUNT(StudentAns[Name])
ok_% =
VAR OK_COUNT = COUNTROWS(
FILTER(
StudentAns,
StudentAns[Answer] = "OK"
)
)
RETURN (OK_COUNT/StudentAns[total_student])
I created a Matrix to show the % of OK for each month as shown in the screenshot below:
What I want to find is the average percentage for all the months. So the final output answer should be 89.05%, which is the average of 85.95%, 91.4%, 89.27% and 89.58%.
The reason I want to get the average percentage of OK across all the months is because I want to use the output as a Target Goals for KPI visualization.
Any help or advise will be greatly appreciated!
You can add one more measure to the matrix as follows:
ok_2 % =
IF(
HASONEVALUE( 'StudentAns'[Month] ),
[ok_%],
AVERAGEX(
VALUES( StudentAns[Month] ),
[ok_%]
)
)
It calculates your original measure for each month, but for the Totals it returns the average of results of your measure.
HASONEVALUE returns True if there is only one distinct value in the filtered context; VALUES - creates a list of unique values; AVERAGEX - calculates the average of a set of expressions evaluated in each row.

How to Rank a Measure which is Average Field, Power BI

I am new in Power bi. I have a table where I have agents details. I have their scores as well. I have date wise data into table where the following columns are available -
I have created created measure for Average of Score where Metric is UES AGGREGATE -
I have to get the ranking of the advocate(s) for the Average Score (UES AGG). I have tried this measure for Ranking calculation -
Rank_UES = RANKX('RankSummary',[RKS_UESAGG])
I am getting wrong ranking. Please help me , how to solve the issue.
Thanking You.
Use ALL function with RANKX.
Rank_UES =
RANKX (
ALL ( 'RankSummary'[AgentfullName] ),
[RKS_UESAGG]
)
I do not know if your [RKS_UESAGG] get you what you want. Suppose you want average sales you make something like this:
Rank_UES =
RANKX (
ALL ( 'RankSummary'[AgentfullName] ),
AVERAGE ( 'RankSummary'[Amount] )
)
https://learn.microsoft.com/en-us/dax/rankx-function-dax

Measure to calculate average

Okay, so I have this dataset.
What I want to do is checking the average number of attempts a student has to take to get to a 6 or higher. So far I came up with:
Students = CALCULATE(DISTINCTCOUNT(StudentResults[studnr]);StudentResults[result]>=6)
Which is how many students passed each class. In SQL, I'd use a Group By and a Having Max. How can I implement this in a measure in Power BI?
To calculate the average number of attempts a student needs to achieve a successful result (>=6) for a course, we need to divide the total number of attempts by the number of succesful attempts.
When counting the total number of attempts, we need to discard the attempts that have not yet led to a successful result, because you cannot count the number of attempts it took to achieve a successfull result if this succesfull result has not been achieved yet.
So the pseudo formula is AVG #Attempts = (all attempts - #No Success Yet) / #Successful Attempts
These are the three base measures:
All Attempts = COUNTROWS ( 'StudenResults' )
#Succesfull Attempts = COUNTROWS ( FILTER ('StudenResults', 'StudenResults'[result] >= 6))
#no succes yet =
SUMX (
'StudenResults',
CALCULATE (
IF ( MAX ( 'StudenResults'[result] ) < 6, 1, 0 ),
ALLEXCEPT ( 'StudenResults', StudenResults[studnr], StudenResults[course] )
)
)
This measure calculates the requested average:
AVG #Attempts = DIVIDE([All Attempts] - [#no succes yet], [#Succesfull Attempts], BLANK ())
A matrix visual, with [course] on Rows and the measures on Values, would look like this:
If you want the average for each student, just put [studnr] on Rows in stead of [course]