Thanks in advance for help.:)
Starting from the beginning i have created this table from this formulas which is developed from another table:
Table =
ADDCOLUMNS (
VALUES ( Main[Job name] ),
"Errors", CALCULATE ( IF ( SUM ( Main[Errors] ) > 1, 0, 1 ) ),
"Total", CALCULATE ( IF ( COUNT ( Main[Job name] ) >= 1, 1, 0 ) )
)
Now i want to calculate from here the following formula from the table : errors/total*100.
Which i have done it and it works but this data is also assigned to dates with this form : Thursday,May 26, 2022 .
Usually i create just a visual with the measure and date and it's automatically calculating for each month the sub-measure but for this one is the same value for all the months. It doesn't calculate for each month and just like a total.
Do you think is the table that i have created or do i have to do something different?
I also tried the slicer and that doesn't work either.
Thanks you very much for your help ! Really appreciated ! :)
If you need any info please let me know !
Update :
Job name
Errors
Total
Date
FTR
EverCommerce, Inc.
0
1
Thursday,May 26, 2022
0
Acutus Medical, Inc.
1
1
Thursday,June 26, 2022
100%
Gatos Silver, Inc.
1
1
Thursday,July 26, 2022
100%
Please see above the table sample. I have included the date as well for reference .
What i want is below :
Date
FTR
May
0
June
100%
July
100%
I want the measure that i created (errors/total*100 ) that you can see above to be aplicable for months analysis as well so i can create later a figure . At this point when i am creating the visual with the date and measure it's giving me the same value for each month . Please see below:
Date
FTR
May
93%
June
93%
July
93%
Thanks a lot for the help again !
You can add the following 2 calculated columns to your table:
Month = 'Table'[Date].[Month]
and
FTR = DIVIDE('Table'[Errors], 'Table'[Total])
Then you can use them in a table visual:
On a side note: The above June and July dates are not valid, since they are not on a Thursday. You have to fix that to be able to calculate the month.
Related
When i drag in a tabel
and just have
-YEAR
-Kategory
-Summa
I will get the medium value of 895,50 (815 + 976 / 2) for february
I don't want it to separeate the Subcategory
I want it to show
1791
when i just mark february
and if i use February and March
It sould say
2022 Inköp 2435,5
Becouse that the Medium of February and Marsh on the category
It's difficult to understand what you are asking (likely the reason for your downvotes). I think you are after a monthly average measure. Since your sample data is extremely limited I assume that each month will have exactly one date. Ideally this type of calculation should be handled by using a calendar table as a basis for month values, but for your sample data, try this:
Monthly average =
AVERAGEX (
VALUES ( 'Table'[Datum] ) ,
CALCULATE ( SUM ( 'Table'[Summa] ) )
)
I have created a report for the HR department. One of the visuals aims to display the pyramid of ages of the employees by gender (we take cluster of 5 years, e.g. 20-25 for people between 20 and 25 years old).
To make it simple, data wise, I have a table with the list of employees, including their date of birth and many other fields, not relevant for this post. I added a calculated column with the age cluster based on the today’s date:
AgeCluster =
VAR AgeCalc=if(HR_DATA[Birthdate]=blank(),blank(),DATEDIFF(HR_DATA[Birthdate],today(),YEAR))
VAR Mult5=INT(AgeCalc/5)
RETURN
if(isblank(AgeCalc),blank(),5*Mult5&"-"&5*(Mult5+1))
And I have a basic visual (tornado chart with the AgeCluster in Group, showing male and female)
Now my issue is that my report should be dynamic, so the user should be able to see the situation in the past or in the future... I have a calendar table (not linked to my HR_Data table), and a date slicer on my report's page. I need the age cluster to be recalculated.
I have tried a calculated table, but I can’t get it working properly. I have read various blog posts on similar issue, but still can't figure out how to solve it...
Any idea or tips much appreciated.
Thank you so much!
Dynamic filtering usually means in these situations that you need a fixed x-axis to work with. That x-axis is calculated outside the original table, such as a parameter table.
Assuming your data looks like this:
Table: Employees
EmployeeID
DOB
1
20 March 1977
2
05 December 1981
3
25 December 1951
4
20 December 1954
5
04 March 1980
6
24 July 1968
7
07 June 1984
8
01 October 1992
9
25 February 1999
10
02 November 1987
First, we need to create the Age Groups with their respective lower and top bands. This table uses a similar code when a parameter table is created.
Table: Buckets
Because you are using whole numbers, I think is best to calculate the TopBand by adding 4. In that case, you don't have repeating numbers. In other words, ranges shouldn't overlap (20-25 and 25-30)
Buckets =
SELECTCOLUMNS (
GENERATESERIES ( 20, 80, 5 ),
"Age Series",
[Value] & " - " & [Value] + 4,
"LowerBand", [Value],
"TopBand", [Value] + 4
)
Also, we will need a Calendar Table to filter accordingly.
Table: CalendarHR
CalendarHR =
ADDCOLUMNS (
CALENDAR ( MIN ( Employees[DOB] ), TODAY () ),
"Year", YEAR ( [Date] )
)
With all that, you can create a calculation that can be filter dynamically.
DAX Measure:
EmployeesbyBracket =
VAR _SelectedDate =
MAX ( CalendarHR[Date] )
VAR _SelectedLowerBand =
SELECTEDVALUE ( Buckets[LowerBand] )
VAR _SelectedTopBand =
SELECTEDVALUE ( Buckets[TopBand] )
VAR EmployeesAge =
ADDCOLUMNS (
Employees,
"Age",
INT ( DATEDIFF ( [DOB], _SelectedDate, YEAR ) / 5 ) * 5
)
RETURN
COUNTROWS (
FILTER (
EmployeesAge,
[Age] >= _SelectedLowerBand
&& [Age] <= _SelectedTopBand
)
)
Output
I've created a table visual with the Age Groups from the Buckets table.
Both a calculated column and a calculated table will be static and not achieve your desired objective. You need age to be calculated via a measure.
Create a disconnected table with your age buckets and then implement the dynamic segmentation pattern.
Using Power Bi desktop,
I need to create a query where the result will be the current month's working days.
For example July 2021 has 22 working days and so on.
My goal for achieving this will be to be to average the number of lines processed divided into the number of working days for the current month.
Will this be possible?
You can always get the job done only by creating just a single measure and nothing else like following
_count =
COUNTX (
FILTER (
VALUES('fact'[_factDate]),
WEEKDAY ( 'fact'[_factDate], 1 ) <> 1
&& WEEKDAY ( 'fact'[_factDate], 1 ) <> 7
),
'fact'[_factDate]
)
The minimum dependency of the calculations are having a calendar table like this
Calendar_Date
Calendar_Year
Calendar_Month
1/1/2000
2000
1
first create a calculated column in you calendar table (Dates for my case) with this below code-
Column = if(
FORMAT(Dates[date],"dddd") = "Saturday"
|| FORMAT(Dates[date],"dddd") = "Sunday",
0,
1
)
now create a measure as below-
weekday = sum(Dates[Column])
now, create visual with month and new measure.
I trying to work with COVID data and find the day on day increase of cases. Essentially, take today's value and minus yesterday's value to get the increase figure. My data also starts on April 10th so if the data is this, I will return a 0.
Given the below formula, the 0 is correctly returned for April 10th but all other values return 17908. All column types are 'Whole number'. Can anybody give me some information on this? Apologies if this is an obvious issue, I am used to working with Python and R and have been thrust into Power BI.
My data is very simple. It just continues like this:
ID Date No of cases
1) 10 April 3
1) 11 April 6
1) 12 April 15
Diff_Daily =
VAR blankValue = 0
VAR difference =
SUM ( Table[No of cases] )
- CALCULATE ( SUM ( Table[No of cases] ), PREVIOUSDAY ( Table[Date] ) )
RETURN
IF ( Table[Date].[Date] = DATE ( 2020, 04, 10 ), blankValue, difference )
In order to solve that I made the following measures. I made more than one just because to me it usually makes more sense (you can re-use them in a KPI or other charts) but you can merge them together if you don't need them all.
Cases = SUM(MyTable[No Of Cases])
Cases (prev Day) =
CALCULATE(
[Cases]
,PREVIOUSDAY(MyTable[Date])
)
Daily Delta =
IF(ISBLANK([Cases (prev Day)])
,0
,[Cases] - [Cases (prev Day)]
)
Let me know if this helps.
About your formula, It looks nice to me, I suggest you check the data type of your columns, especially the date one. other than that the only error I see is the use of a field inside the IF statement, you may want to use ISBLANK([MyMeasure]) (at least in this case)
I am looking for unit counts when the equipment is not in the date range (start and end dates).
How do I make a measure "AvailUnitCount" to give me unit counts by category in the timeline dimension (say November 11, 2018)?
I think it can be achieved via a measure in Power Pivot and date table, but I am just quite new to DAX and time dimension concept overall.
My measure reads:
AvailUnitCount := CALCULATE( DISTINCTCOUNT( EquipUsage[EquipmentNo] ) )
How do I incorporate time dimension into the measure above, so I can report on available equipment for a specific date by moving a timeline in Excel?
Please see the data set and the desired outcome below. I immensely appreciate your advice on this.
Table 1: EquipUsage
EquipNo CategoryNo UsageStartDate UsageEndDate
----------------------------------------------------
10005164 A020004004 5-Nov-18 5-Dec-18
10005167 A020004004 24-Oct-18 10-Nov-18
10005176 A020004005 9-Oct-18 5-Dec-18
10015982 A020004006 18-Feb-18 5-Sep-18
10019170 A020004006 16-Aug-18 30-Mar-19
10019551 A020004006 2-May-17 10-Nov-18
10005178 A020004007 20-Sep-18 15-Jan-19
Table 2: EquipCategories (Example of Desired Outcome for November 11, 2018)
CategoryNo AllUnits AvailableUnits
--------------------------------------
A020004004 2 1
A020004005 1 0
A020004006 3 2
A020004007 1 0
The AllUnits measure is simple:
AllUnits = COUNTROWS(EquipUsage)
For availability, read in your desired date and sum up the rows where that date does not fall in the given date range:
AvailableUnits =
VAR CheckDate = SELECTEDVALUE(DateTable[Date])
RETURN SUMX(EquipUsage,
IF(
EquipUsage[UsageStartDate] <= CheckDate &&
EquipUsage[UsageEndDate] >= CheckDate,
0,
1
)
)