Forum Discussion
Making a calculated table
- 9 years ago
Hi kjartank,
If I understand you correctly, you should be able to use the formulas below to get your expected result.
1. Add a new calculate column "QuarterNO" to your table.
QuarterNO = VALUE ( LEFT ( Tabel2[Quarter], 4 ) ) * 4 + VALUE ( MID ( Tabel2[Quarter], 6, 1 ) )2. Create different measures to calculate "Score", "+\-", and "Satisfied%", then show them on the Table visual with the "Booking-Where" column.
Score = VAR latestQuarter = CALCULATE ( MAX ( Tabel2[QuarterNO] ), ALL ( Tabel2 ) ) RETURN CALCULATE ( AVERAGE ( Tabel2[Booking - Satisfaction] ), Tabel2[QuarterNO] = latestQuarter )+/- = VAR latestQuarter = CALCULATE ( MAX ( Tabel2[QuarterNO] ), ALL ( Tabel2 ) ) RETURN CALCULATE ( AVERAGE ( Tabel2[Booking - Satisfaction] ), Tabel2[QuarterNO] >= latestQuarter - 2 && Tabel2[QuarterNO] <= latestQuarter - 1 ) - [Score]Satisfied% = VAR latestQuarter = CALCULATE ( MAX ( Tabel2[QuarterNO] ), ALL ( Tabel2 ) ) RETURN DIVIDE ( CALCULATE ( COUNTROWS ( Tabel2 ), FILTER ( Tabel2, Tabel2[QuarterNO] = latestQuarter && Tabel2[Booking Satisfied] = "Satisfied" ) ), CALCULATE ( COUNTROWS ( Tabel2 ), FILTER ( Tabel2, Tabel2[QuarterNO] = latestQuarter ) ) )Here is the modified pbix file for your reference. :smileyhappy:
Regards
Hi kjartank,
If I understand you correctly, you should be able to use the formulas below to get your expected result.
1. Add a new calculate column "QuarterNO" to your table.
QuarterNO =
VALUE ( LEFT ( Tabel2[Quarter], 4 ) ) * 4
+ VALUE ( MID ( Tabel2[Quarter], 6, 1 ) )
2. Create different measures to calculate "Score", "+\-", and "Satisfied%", then show them on the Table visual with the "Booking-Where" column.
Score =
VAR latestQuarter =
CALCULATE ( MAX ( Tabel2[QuarterNO] ), ALL ( Tabel2 ) )
RETURN
CALCULATE (
AVERAGE ( Tabel2[Booking - Satisfaction] ),
Tabel2[QuarterNO] = latestQuarter
)
+/- =
VAR latestQuarter =
CALCULATE ( MAX ( Tabel2[QuarterNO] ), ALL ( Tabel2 ) )
RETURN
CALCULATE (
AVERAGE ( Tabel2[Booking - Satisfaction] ),
Tabel2[QuarterNO]
>= latestQuarter - 2
&& Tabel2[QuarterNO]
<= latestQuarter - 1
)
- [Score]
Satisfied% =
VAR latestQuarter =
CALCULATE ( MAX ( Tabel2[QuarterNO] ), ALL ( Tabel2 ) )
RETURN
DIVIDE (
CALCULATE (
COUNTROWS ( Tabel2 ),
FILTER (
Tabel2,
Tabel2[QuarterNO] = latestQuarter
&& Tabel2[Booking Satisfied] = "Satisfied"
)
),
CALCULATE (
COUNTROWS ( Tabel2 ),
FILTER ( Tabel2, Tabel2[QuarterNO] = latestQuarter )
)
)
Here is the modified pbix file for your reference. :smileyhappy:
Regards
I need the list of formulas for Power BI.
Like they do in excel.
Where Can I get it?