I am trying to do a burndown graph on PowerBI.
My data is a list of tasks. Each task has a numerical value (EFFORT) assigned to it and there is a total amount of effort for any given month (sum of all EFFORT). As tasks as set to DONE, the ongoing effort should be deducted from a running total and that value used to plot a graph. I have 3 columns
I would like to have measure to calculate EFFORT REMAINING for each date, i.e.
EFFORT REMAINING = TOTAL EFFORT - (EFFORT WHEN TASKS ARE DONE FOR EACH DAY)
For example,
I did get the consecutive dates displaying:
Burndown = CALENDAR(DATE(2022,7,1),DATE(2022,7,31))
and also the total effort (starting value)
TOTAL EFFORT = SUM(Issues[EFFORT])
Now for each date in table, I need to minus the accumulating total of EFFORT when the status is set to DONE
EFFORT REMAINING = Burndown[TOTAL EFFORT]-SUM(Issues[EFFORT]="DONE" ....
Im stuck after this last point. Can anyone help, please?
you are so close to the answer ). Convert SUM(Issues[EFFORT]="DONE" to:
CALCULATE(
SUM(Issues[EFFORT])
, SUM(Issues[Status]="DONE"
)
Have a nice day.
Please try this measure:
Please ensure that (1-Many) relationship is created between Burndown [Date] and Issues[ISSUE_CREATED] columns.
EFFORT REMAINING =
VAR TblSummary =
ADDCOLUMNS (
SUMMARIZE ( Issues, Burndown[Date] ),
"Total Effort", CALCULATE ( SUM ( Issues[EFFORT] ) ),
"Tasks Completed", CALCULATE ( SUM ( Issues[EFFORT] ), Issues[STATUS] = "DONE" ),
"Effort Remaining",
CALCULATE ( SUM ( Issues[EFFORT] ) )
- CALCULATE ( SUM ( Issues[EFFORT] ), Issues[STATUS] = "DONE" )
)
VAR Result =
SUMX ( TblSummary, [Effort Remaining] )
RETURN
Result
After that, you can create a clustered column chart, and put [Date field] on calendar table on X_axis and put 'EFFORT REMAINING' measure on Y_axis(Value axis) to see the result.
I hope It solves your problem.
Bonus Info:
If you want to see your Summary table, create a "New Table" and paste this code:
Summary_Table =
VAR TblSummary =
ADDCOLUMNS (
SUMMARIZE ( Issues, Burndown[Date] ),
"Total Effort", CALCULATE ( SUM ( Issues[EFFORT] ) ),
"Tasks Completed", CALCULATE ( SUM ( Issues[EFFORT] ), Issues[STATUS] = "DONE" ),
"Effort Remaining",
CALCULATE ( SUM ( Issues[EFFORT] ) )
- CALCULATE ( SUM ( Issues[EFFORT] ), Issues[STATUS] = "DONE" )
)
VAR Result =
SUMX ( TblSummary, [Effort Remaining] )
RETURN
TblSummary
The result It produces:
Note: I have limited access to your data sets as you shared above. The result will be exact with your full dataset.
Related
I have a DAX code that I know can be hugely improved on in terms of efficiency and performance but I'm not quite sure how to go about it.
Total GMRR (EUR) =
SUMX (
FILTER (
SUMMARIZE (
fact_transaction_monthly,
dim_partner[partner_created_date],
dim_partner[partner_name],
"GMRR", SUM ( fact_transaction_monthly[euroConsolidatedGMRR] ),
"check", [checkActive]
),
[check] = 1
),
[GMRR]
)
I am creating a summary table and summing over the values where the check is equal to 1 but this is taking a long time to compute
Check Active Code:
checkActive =
IF ([Total Active Partners] = 1,1,0)
Total GMRR (EUR) =
SUMX (
CALCULATETABLE (
SUMMARIZE (
fact_transaction_monthly,
dim_partner[partner_created_date],
dim_partner[partner_name],
"GMRR", SUM ( fact_transaction_monthly[euroConsolidatedGMRR] )
),
[checkActive] = 1
),
[GMRR]
)
i have done a Measure to get the Revenue from TOP N Products.
N depends on the selected Value from my TOP-N Table (It's containing just the numbers from 1 to 10).
In the same Measure, I also calculate how much was the revenue of all Products how were not in the selected Top N.
The Code for this is:
Top N Produktbez Sum DB3 =
VAR TopNSelected =
SELECTEDVALUE ( 'TOP N-Filter'[TOP N] )
VAR TopNProdbezTable =
TOPN ( TopNSelected, ALLSELECTED ( 'Pseudo Produkbez Table' ), [DB3] )
VAR TopNProdbez =
CALCULATE ( [DB3], KEEPFILTERS ( TopNProdbezTable ) )
VAR OtherSales =
CALCULATE ( [DB3], ALLSELECTED ( 'Pseudo Produkbez Table' ) )
- CALCULATE ( [DB3], TopNProdbezTable )
VAR CurrentProd =
SELECTEDVALUE ( 'Pseudo Produkbez Table'[Produktbezeichnung] )
RETURN
IF ( CurrentProd <> "Others", TopNProdbez, OtherSales )
Now I want to add Year as Filter.
I'm using the Year coming from the Date Hierarchy.
Unfortunately, I can't provide a sample yet.
If a sample is need, I will try to create own.
I need to calculate the ongoing revenue for installation + maintenance for projects and calculate the monthly revenue for controlling purposes in DAX in Power BI.
The problem is the following.
The projects are stored in a table CONTRACTS like this:
And I have a separate date table INST_DATE_TABLE:
The tables are connected via the [INSTALLATION_DATE] field.
For every month the revenue is the total of the [INSTALLATION_REVENUE] if the installation was carried out that month plus from the first month on the monthly maintenance revenue which is given as the [MAINTENANCE_COST_PER_UNIT] * [MAINTENANCE_UNIT] / 12.
And the maintenance revenue should be only calculated if the current date is beyond the installation date!
Some contracts are not yet signed, so they dont't have an installation date set (NULL)
So the INSTALLATION REVENUE DAX is like this:
.INSTALLATION_REVENUE =
CALCULATE (
SUMX(CONTRACTS;
CONTRACTS[INSTALLATION_REVENUE]
);
CONTRACTS[INSTALLATION_DATE] > 0
)
And the MONTHLY REGULAR REVENUE is like this:
.REGULAR_REVENUE =
CALCULATE (
SUMX(CONTRACTS;
CONTRACTS[MAINTENANCE_COST_PER_UNIT]*CONTRACTS[MAINTENANCE_UNIT]
) / 12;
CONTRACTS[INSTALLATION_DATE] > 0
)
For all dates I can calculate the cash flow of the latter like this:
.REGULAR_REVENUE_ONGOING =
CALCULATE (
[.REGULAR_REVENUE];
ALL(INST_DATE_TABLE[INSTALLATION_DATE])
)
which gives me a nice series of monthly revenues for all periods. But I only would like to see this for the periods that are beyond the installation date!
So lets say filtered on contract 1 I have now the following cash flow:
But for periods before 2019.04.01 I would like to see zeros!
How can I do that?
I just can't filter on dates referring to the installation date of the project!
After I have the expected result for one contract it would be easy to sum it up for all contracts like this
.TOTAL_REVENUE =
[.INSTALLATION_REVENUE] + [.REGULAR_REVENUE_EXPECTED]
UPDATE:
I created a cumulative total to display the ongoing revenue as such:
.REGULAR_REVENUE_ONGOING =
CALCULATE (
[.REGULAR_REVENUE];
FILTER(
ALL(INST_DATE_TABLE[INSTALLATION_DATE]);
INST_DATE_TABLE[INSTALLATION_DATE
<=MAX(INST_DATE_TABLE[INSTALLATION_DATE])
)
)
this displays the correct series, but now I have another problem. When I try to cumulate this already cumulative data series it does not add up as a cumulative data series!
Any help would be appreciated
.REVENUE_TOTAL_CUMULATIVE =
CALCULATE(
[.REVENUE_TOTAL];
FILTER(
INST_DATE_TABLE;
INST_DATE_TABLE[INSTALLATION_DATE] <= MAX(INST_DATE_TABLE[INSTALLATION_DATE])
)
)
Assuming there are no end dates to your ongoing revenue, then try:
.REGULAR_REVENUE_ONGOING =
VAR DateMin =
CALCULATE(
MIN ( CONTRACTS[INSTALLATION_DATE] ),
ALL ( INST_DATE_TABLE )
)
VAR DateMax =
MAX ( INST_DATE_TABLE[INSTALLATION_DATE] )
RETURN
SUMX (
FILTER (
ALL ( INST_DATE_TABLE ),
INST_DATE_TABLE[INSTALLATION_DATE] >= DateMin && INST_DATE_TABLE[INSTALLATION_DATE] <= DateMax
),
[.REGULAR_REVENUE]
)
And for a cumulative total revenue:
.REVENUE_TOTAL_CUMULATIVE =
VAR DateCurrent = MAX ( INST_DATE_TABLE[INSTALLATION_DATE] )
VAR CumulativeInstallationRevenue =
CALCULATE (
[.INSTALLATION_REVENUE],
FILTER (
ALL ( INST_DATE_TABLE ),
INST_DATE_TABLE[INSTALLATION_DATE] <= DateCurrent
)
)
VAR CumulativeOngoingRevenue =
SUMX (
FILTER (
ALL ( INST_DATE_TABLE ),
INST_DATE_TABLE[INSTALLATION_DATE] <= DateCurrent
),
[.REGULAR_REVENUE_ONGOING]
)
RETURN
CumulativeInstallationRevenue + CumulativeOngoingRevenue
See https://pwrbi.com/so_55808659/ for worked example PBIX file
I created 80/20 segmentation in my Power BI data model and I got what I wanted (see the table below).
Now I want to calculate new Name column with the next logic: if Cumulative % <=80% show value from the "Customer Name" column, otherwise show "Other" (the result will be the column Name as in the table below).
I tried with this calculated column but it doesn't work (the result isn't correct, it's always "Other"):
80/20 Name = IF([Cumulative Percen.] <= 0.8, SalesReport[Names], "Other")
Note: "Cumulative Percen." is calculated measure.
How can I do this?
In the next step, I'll use a pie chart to show this segmentation where all customers with small cumulative transactions will be categorized as Other.
The calculated measures that I used:
Customer Rank by Transaction =
IF (
HASONEVALUE ( SalesReport[CustName] ),
RANKX (
ALLSELECTED ( SalesReport[CustName] ),
CALCULATE ( [# of Transactions] ),
,
DESC,
DENSE
)
)
Customer Cumulative Transaction =
VAR CurrentCustimerRank = [Customer Rank by Transaction]
RETURN
SUMX (
FILTER (
ALLSELECTED ( SalesReport[CustName] ),
CALCULATE ( [Customer Rank by Transaction] ) <= CurrentCustimerRank
),
CALCULATE ( DISTINCTCOUNT ( SalesReport[CustID] ) )
)
Customer Cumulative Transaction Percen. =
[Customer Cumulative Transaction]
/ CALCULATE (
DISTINCTCOUNT ( SalesReport[CustID] ),
ALLSELECTED ( SalesReport[CustName] )
)
I am coming across an issue while dividing two measures "Spend running total" and "Total Invoiced Amount", which are calculated as :
Spend running total (numerator)= VAR InvoicedAmount =
CALCULATE ( SUM ( [Invoiced Amount]) )
RETURN
CALCULATE (
SUM ( [Invoiced Amount] ),
FILTER (
ALL ( [Vendor name] ),
CALCULATE ( SUM ( [Invoiced Amount] ) >= InvoicedAmount )
)
)
Total Invoiced Amount(Denominator) = SUM([Invoiced Amount])
The division is not evaluated and I don't see a line for that in the chart, but when I replace it with the hard coded value, it evaluates and can be seen in the chart.
Am I missing something? Would really appreciate any help.
Thanks for responding. I was able to resolve the issue By creating a quick measure by creating "Totals" for category in this case for "Vendor Name" which resulted in aggregating the "Invoice Amount" field by Vendor Name. Here's the complete formula :
% Running Total = [Spend running Total]/[Invoiced Amount total for Vendor name], where
Spend running Total = VAR InvoicedAmount =
CALCULATE ( SUM ( [Invoiced Amount]) )
RETURN
CALCULATE (
SUM ( [Invoiced Amount] ),
FILTER (
ALL ( [Vendor name] ),
CALCULATE ( SUM ( [Invoiced Amount] ) >= InvoicedAmount )
)
)
Invoiced Amount total for Vendor name =
CALCULATE(
SUM([Invoiced Amount]),
ALL([Vendor name])
)
This solved the issue of division for me.