It is necessary to calculate the percentage of the completion of the period by the Slice of the date, i.e. 100% is from 01 to 31 days, 97% is from 01 to 30 days, etc. or 1 day is 3%.
The % period formula looks something like this ((current day - 1 day)*100)/period
Tried to describe it like this
Period = CALCULATE((TODAY()-1)*100)/sum(GKB[stat_date])
But the output is 0.11...
Since there are no separate columns Start date and End date, but only a slice element with a slider, I don’t understand how to implement this and why to start.
enter image description here
Related
I'm new to PowerBI, so please forgive, if this is a very simple question.
I have a dataframe that holds information on patients, a timestamp for a visit at a hospital dept, which type of visit and if the amount of time between their first visit and last visit meet a certain criteria for the amount of time between the two. I created an index to be able to calculate the # of days betweeen each row's visit and the visit in the previous row. The duration is calculated based on the sum of days between visits for each single patient and the OF4-criteria is checking if the duration is above or below a certain threshold.
It looks something like this:
ID
Timestamp
Event
Index
Days_since_last_visit
Duration
OF4-criteria
01257
11-10-2021
CT-scan
0
0
79
Not met
01257
02-11-2021
PET-scan
1
22
79
Not met
01257
29-12-2021
F-code
3
47
79
Not met
5789
24-11-2021
CT-scan
4
0
29
Met
5789
7-12-2021
ECG
5
13
29
Met
and so on...
My goal is to be able to create a slider, so that I can play around with the # of days between visits and investigate, what happens with the ratio of patients that meet og don't meet the OF4-criteria.
I created a "what-if" parameter for the user to input an amount of days, that I want to subtract from the variable duration, but I can't use the input to calculate a new column, since it is a measure and only can be used in other measures.
Ideally what I want is to be able to create a new column named "what-if-duration", that is calculated with the original column "duration" and has the number of days subtracted.
Does anyone know a way to do this?
I have set up a table showing number of sick days based on absence start and finish date in Power BI. The date tables have been set up.
I am having an issue with sick days that continue in the following month, for e.g .
Absence Start Date
5 May 21
Absence End Date
5 June 21
My table sums all the absence days in May.
How do I allocate the 25 days in May and then the remaining go to June even though it is one occurrence?
How Data is being summarised
Unfortunately you don't provide enough information about your model/ data. Consider this example. Here is my dummy table:
Table 3 =
var __baseTable =
DATATABLE("StartD",DATETIME, "EndD", DATETIME,
{
{"2020-01-28","2020-02-24"},
{"2019-12-23","2020-01-31"},
{"2020-01-20","2020-02-17"}
}
)
return
ADDCOLUMNS(GENERATE(__baseTable, CALENDAR([StartD],[EndD])),"Month", FORMAT([Date],"yyyy-mm"), "WorkDay", IF(NOt(WEEKDAY([Date]) in {1,7}) ,1,0))
And here are measures (calculating days without a weekend, because I don't have Calendar with businessHoliday):
SumOfSickDays = CALCULATE(SUM('Table 3'[WorkDay]))
I have 3 measures:
1) total_trx = SUM(mytable[trx])
2) trx_prev_month = CALCULATE([total_trx], DATEADD(calendar[date], -1,MONTH))
3) monthly_var = DIVIDE([total_trx],[trx_prev_month])-1
If I add a waterfall viz, x-axis with month, it gives me the % of monthly variation and a TOTAL bar at the end that sums all the variations.
I need to reproduce that total number in order to show a KPI as in "so far, we've increased ...%", changing when using a date slicer.
Seems like sum(monthly_var) is not allowed.
Any ideas?
Thank you very much.
Edit1: sample with date filter = Last 4 months
Jul 100 0%
Aug 110 10%
Sep 90 -20%
Oct 80 -10%
Total: -20% <- need a dax to calculate this number and show just -20%
Then if I change the filter to, for example LAST 6 MONTHS, I need to calculate it up to May
In order to get the desired result we will use an intermediate table in our query that will summarize the results by months:
use this code and replace calendar[Year Month] with your Year month column :
SUMX(
SUMMARIZECOLUMNS(calendar[Year Month],"Monthly_int_var",[monthly_var]),
[Monthly_int_var]
)
I need to make a total for each of the months based on the working days.
So far i have working days set as 1 if the day in the month is during Monday - Friday and 0 for Saturday and Sunday. I now need to total up the 1's and make it so that it is a single value for the month.
E.g Going the weekdays is 1 and weekend is 0, January will have 22 days on each row on the table in the data mode - January 1 = 232 January 2 = 22 etc. so i can use it to divide against my target which is set to the 1st of every month.
How can i do this??
try this. i haven't tested it.
=GROUPBY( FILTER(table, table[Working_Day]=1) , table[Month], ["new col", SUMX( CURRENTGROUP(), table[Month_Order])])
filter gives working day 1's data as table,then group by performed by month, then month order has been added and returns table.
I want to create a visualisation from a dataset which shows percentages that change accordingly when filters are used.
I have a dataset like the below but with over 1 million rows of data covering 18 months. All the fields are text except Month which is a date and SUMofAPPTS which is numerical.
SUPP GEOG1 MODE STATUS TYPE TIME Month Day SUMofAPPTS
AA 00D Face Att 1 1 Day 2018-06 Sun 12
AA 00D Face Att 1 1 Day 2018-06 Mon 119
AA 00D Face Att 1 4 Unk 2018-06 Tues 98
BB 00D Tel DNA 2 1 Day 2018-06 Weds 98
BB 00D Online DNA 3 1 Day 2018-06 Thurs 126
CC 00D Face DNA 1 2 Day 2018-07 Sun 8
I would like a measure which calculates the percentage of SUMofAPPTS by Day and MODE (and the same but for STATUS, TYPE and TIME) which changes when filters are placed on the other fields.
So I think I need to make this simple calculation (which would work in a column if I just wanted to know the percentage per row of the whole dataset) more dynamic so that it works when I filter the data:
PERCENT = 'dataset'[SUMofAPPTS]/SUM('dataset'[SUMofAPPTS])
The end result will be a stacked bar chart with the following attributes:
Day as the Axis
PERCENT as the Value
MODE, STATUS, TYPE or TIME as the Legend
Ability to filter by one, many or all of the fields except Day and SUMofAPPTS
First, create a measure for aggregating SUMofAPPTS:
Total APPTS = SUM(Data[SUMofAPPTS])
Second, create a measure for the percentage:
APPTS % of Selected
= DIVIDE(
[Total APPTS],
CALCULATE([Total APPTS], ALLSELECTED()))
This measure recalculates [Total APPTS] ignoring all filters except those selected by a user (on slicers etc).
Result:
after selections:
Edit
If you need to breakdown by Day (or any other field), you can re-introduce filters like this:
APPTS % of Selected
= DIVIDE(
[Total APPTS],
CALCULATE([Total APPTS], ALLSELECTED(), VALUES(Data[Day])))