Forum Discussion
Haidannx
Helper I
6 years agoCANT VISUALIZE DATA ON POWERBI
Hello guys, i have a dataset like this and i don`t know how to visualize the total fare of each airlines in the dataset because some customers didn`t pick the same airlines for their travel. (total f...
- 6 years ago
Hi Haidannx ,
You need to create two calculated columns:
inb = 'Table'[Inbound fare]*'Table'[number of Adult]out = 'Table'[Outbound fare]*'Table'[number of Adult]Then create a calculated table:
Table2 = VALUES('Table'[Outbound airline])Finally, create the following measure:
in-ou = VAR _in = IF ( HASONEVALUE ( 'Table2'[column] ), CALCULATE ( SUM ( 'Table'[inb] ), FILTER ( 'Table', 'Table'[Inbound airline] = MIN ( 'Table2'[column] ) ) ), SUMX ( 'Table2', CALCULATE ( SUM ( 'Table'[inb] ), FILTER ( 'Table', 'Table'[Inbound airline] = MIN ( 'Table2'[column] ) ) ) ) ) VAR _ou = IF ( HASONEVALUE ( 'Table2'[column] ), CALCULATE ( SUM ( 'Table'[out] ), FILTER ( 'Table', 'Table'[Outbound airline] = MIN ( 'Table2'[column] ) ) ), SUMX ( 'Table2', CALCULATE ( SUM ( 'Table'[out] ), FILTER ( 'Table', 'Table'[Outbound airline] = MIN ( 'Table2'[column] ) ) ) ) ) RETURN _in + _ou ) )Results are as follows:
Here is a demo, please try it:
Best Regards,
Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-joesh-msft
Solution Sage
6 years agoHi Haidannx ,
You need to create two calculated columns:
inb = 'Table'[Inbound fare]*'Table'[number of Adult]out = 'Table'[Outbound fare]*'Table'[number of Adult]Then create a calculated table:
Table2 = VALUES('Table'[Outbound airline])Finally, create the following measure:
in-ou =
VAR _in =
IF (
HASONEVALUE ( 'Table2'[column] ),
CALCULATE (
SUM ( 'Table'[inb] ),
FILTER ( 'Table', 'Table'[Inbound airline] = MIN ( 'Table2'[column] ) )
),
SUMX (
'Table2',
CALCULATE (
SUM ( 'Table'[inb] ),
FILTER ( 'Table', 'Table'[Inbound airline] = MIN ( 'Table2'[column] ) )
)
)
)
VAR _ou =
IF (
HASONEVALUE ( 'Table2'[column] ),
CALCULATE (
SUM ( 'Table'[out] ),
FILTER ( 'Table', 'Table'[Outbound airline] = MIN ( 'Table2'[column] ) )
),
SUMX (
'Table2',
CALCULATE (
SUM ( 'Table'[out] ),
FILTER ( 'Table', 'Table'[Outbound airline] = MIN ( 'Table2'[column] ) )
)
)
)
RETURN
_in + _ou
)
)Results are as follows:
Here is a demo, please try it:
Best Regards,
Community Support Team _ Joey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Haidannx6 years ago
Helper I
thanks alot 😄