I have a dataset with consumption data of multiple Machines for each day. The table also contains Parts information to identify how many parts needs to be exchanged or checked on a particular day.
The dashboard has to display consumption data in the form of a line and parts checked or exchanged in column chart.
Sample Data table:
I want to summarize consumption based on Months in a Line and Column chart. I have created the below Measure in DAX called Consumptionactual
consumptionactual = SUMX(DISTINCT(ReportMaintenance[Consumption]),FIRSTNONBLANK(ReportMaintenance[Consumption], 0))
Instead I should be getting, Eg. Consumption = 3300 for the whole month if everyday Consumption is 110.
If I remove the Distinct clause, I am getting sum of consumption based on every part listed for that particular day, which is also incorrect. See below,
I am using the following 2 measures to calculate the number of parts to be checked or changed for a particular day. There will be multiple parts to be checked or changed on a particular day.
changeop = CALCULATE(COUNT(ReportMaintenance[MachineId]),FILTER(ReportMaintenance,ReportMaintenance[Operation]="Change"))
checkop = CALCULATE(COUNT(ReportMaintenance[MachineId]),FILTER(ReportMaintenance,ReportMaintenance[Operation]="Check"))
Can anyone help in calculating the correct consumption?
Related
I am trying to create a forecast but this is the error that I get:
I am working with about 300,000 rows of data. Most of the report has already been built. My data just doesn't cotain certain dates. How can I solve this issue?
So the issue boils down to the problem of "How to create an evenly spaced timeline". You can easily achieve this in PowerQuery
Create a separate daily date table.
Outer join your observations onto the dates, which will give you "null" for the unobserved days
Apply the "fill down" operation on your values column, which basically means that the last value will be repeated until a new observation appears.
These evenly distributed time series is suitable for ML forecasting, at least when it comes to predicting trends. But the real power of this feature in Power BI is in predicting seasonality, and you most likely won't get that right with the above interpolation.
Working with unemployment data, and I want to count the number of weeks that a client has received benefits during the last 52 weeks.
I have a dataset with many tables which are all connected via the client number in a fact table. In the fact table the client number occurs for every week of the year in one column, another column shows the type of benefits (if any) received in the current week. So I have a long format.
The other two relevant tables contains
A: List of client number appearing only once per client, but no information about benefits received or week number.
B: List of benefits
Tried counting the rows in my fact table while filtering so as only to do so for the specific benefit I am interested in, but I can't make it work so far.
Weeks on benefit A =
CALCULATE(DISTINCTCOUNT(FactDream[DimDreamBorger]);
DimDreamYdelse[dagpenge] = 1)
sample data
I just need a table showing how many weeks the individual client has received a specific benefit, but I keep getting a total sum of the weeks that all the clients have received the benefit.
Best would be if you add the following measure:
=CountRows(YourTable)
Put this measure into a chart visual. Then add a filter visual and put your Benefit column into the filter visual.
This way you can filter after your benefits, which you are interested, and see the result in the chart.
I have two measures, which calculate the same amount for 2 different columns (i.e. total for person and total for the site) and returns the person/site having the highest amount.
I have report level filters on both Person and site. When playing around with these filters (either person or site), sometimes the measure returns blank randomly.
i.e I filtered to a single person and got the following:
Now, when I open ANY MEASURE IN THE REPORT, and simply add a blank line or remove a blank line (it refreshes the report I guess):
The measure will now show the proper value. The fun part is, I did not change the measure at all, just added a blank line or removed it and hit enter. The problem occurs randomly for both person and site measures.
For obvious reasons, I cannot expose many details here. Please let me know if you have to look at measures, I will post dummy ones.
Any help would be appreciated, Thank You!
Replacing the RANKX(Rank = 1) filter with TOP N did the thing.
The measures were using RANKX to generate a table variable, which was then filtered with rank = 1 condition. Sometimes, the table was not having rank 1 at all, the ranks started from 2,4, etc. I am still not sure what was the root cause of ranks not calculating properly.
Using TOPN function eliminated the rank filtering thing and the measures are now functioning properly.
We have been conducting a survey within our business and I will shortly be preparing the results to share with a number of internal customers.
The number of survey respondents is around 700, so I want to allow the people looking at the reports to be able to filter the data to identify trends according to the demographic and organisational groups identified within the report (sample data below).
What I am looking to do is present the information in a way that prevents the users from using a combination of the slicers to identify the responses of specific individuals.
I wanted to obscure the results for cases where the group of people selected is less than 5 individuals and created the following measure:
[Anonymised Rowcount]:=if(COUNTROWS(('Table1'))<5,0,[RowCount])
However the results it gives aren't quite what I need:
I want all the values of [Anonymised Rowcount] to be zero when the combination of slicers gives me less than 5 active rows in the table.
I'm getting a zero in any columns when the count for that column falls below 5.
NOT the desired result!
I've tried various combinations of ALL() and ALLSELECTED(), but I've not yet managed to come up with a correct combination the will give me a count of the rows in the table that ignores the column, but respects the slicer selections. My attempts so far have either given me every row in the table, ignoring the columns and slicers, or only the selected rows within each column heading.
EDIT:
Main question resolved
I've found the Solution using:
[Anonymised Rowcount]:=if(COUNTROWS(ALL('Table 1'[Question 1]))<5,0,[RowCount])
Bonus Question: Does anyone have a more elegant way of obscuring the results of small groups than just setting all the responses to zero.
I am working on a report that has data by month. I have created a measure that will calculate a cost per unit which divides the sum of dollars by the sum of production volume for the selected month(s):
Wtd Avg = SUM('GLData - Excel'[Amount])/SUM('GLData - Excel'[Production])
This works well and gives me the weighted average that I need per report category regardless of if I have one or multiple months selected. This actual and budget data is displayed below:
If you take time to total the actual costs you get $3.180. Where I am running into trouble is a measure to sum up to that total for a visual (This visual does not total sadly). Basically I need to sum the aggregated values that we see above. If I use the Wtd Avg measure I get the average for the total data set, or .53. I have attempted another measure, but am not coming up with the correct answer:
Total Per Unit Cost = sumX('GLData - Excel','GLData - Excel'[Wtd Avg])/DISTINCTCOUNT('GLData - Excel'[Date])
We see here I return $3.186. It is close, but it is not aggregating the right way to get exactly the $3.180:
My Total Per Unit Cost formula is off. Really I am simply interested in a measure to sum the post aggregated Wtd Avg measure we see in the first graph and total to $3.180 in this example.
Here is my data table:
As you probably know already, this is happening because measures are dynamic - if you are not grouping by a dimension, they will compute based on the overall table. What you want to do is to force a grouping on your categories, and then compute the sum of the measure for each category.
There are 2 ways to do this. One way is to create a new table in Power BI (Modeling tab -> New Table), and then use a SUMMARIZE() calculation similar to this one to define that table:
SUMMARIZE('GLData - Excel',[Category],[Month],[Actual/Budget],"Wtd Avg",[Wtd Avg])
Unfortunately I do not know your exact column names, so you will need to adjust this calculation to your context. Once your new table is created, you can use the values from that table to create your aggregate visual - in order to get the slicers to work, you may need to join this new table to your original table through the "Manage Relationships" option.
The second way to do this is via the same calculation, but without having to create a new table. This may be less of a hassle. Create a measure like this:
SUMX(SUMMARIZE('GLData - Excel',[Category],[Month],[Actual/Budget],"Wtd Avg",[Wtd Avg]),[Wtd Avg])
If this does not solve your issue, go ahead and show me a screenshot of your table and I may be able to help further.