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.
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.
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?
I'm wanting to show the difference between Connections and Disconnects over a timeline. If I can create a measure that stores the number of connects or disconnects each day I can subtract them from each other to get the difference.
For an example I'm counting how many records have the same disconnect date. I've tried working with the count function but I'm not sure how to count the number of records for each day.
At this point I'm not sure I have meaningful code to share. :(
A solution would hopefully be able to produce a table that shows the connect or disconnect date along with how many records have that same date.
The meaningful fields would be the Acct and the Disc_dt or Conn_dt.
All accounts will have a connect date but may not have a disconnect date.
ex.
DATE - COUNT
01/01/2018 - 3
02/01/2018 - 5
03/01/2018 - 4
Please have a look at the following question:
How to calculate daily population in DAX
It will give you a solution you can use also if I understand you correct.
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'm trying the new Power BI (Desktop) to create a barchart that shows me the duration in days for the delivery of an order.
I have 2 files. 1 with the delivery data (date, barcode) and another file with the deliverystatusses (date, barcode).
I Created a relation in the powerBI relations tab on the left side to create a relation on barcode. 1 Delivery to many DeliveryStatusses.
Now I want to add a column/measure to calculate the number of days before a package is delivered. I searched a few blogs but with no succes.
The function DATEDIFF is only recognized in a measure, and measures seem to work on table date, not rowdata. So adding a column using the DATEDIFF function doesn't work.
Adding a column using a formula :
Duration = [DeliveryDate] - Delivery[OrderDate]
results in an error that the right side is a list (It seems the relationship isn't in place)?
What am I doing wrong?
You might try doing this in the Query window instead since I think each barcode has just one delivery date and one delivery status. You could merge the two queries into a single table. Then you wouldn't need to worry about the relationships... If on the other hand you can have multiple lines for each delivery in the delivery status table, then you need to get more fancy. If you're only interested in the last status (as opposed to the history of status) you could again use the Query windows to group the data. If you need the full flexibility, you'd probably need to create a Measure that expresses the logic you want.
The RELATED keyword is used to reference another table. Update your query as follows and it should work.
Like this:
Duration = [DeliveryDate] - RELATED(Delivery[OrderDate])