The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
I have below table,
Person | Q1 Att | Q2 Att | Q3 Att | Q4 Att |
A | 10 | 16 | 32 | 32 |
B | 11 | 12 | 12 | 12 |
C | 12 | 13 | 32 | 43 |
D | 13 | 16 | 3 | 23 |
E | 14 | 23 | 43 | 43 |
F | 15 | 43 | 43 | 34 |
G | 16 | 23 | 4 | 34 |
H | 17 | 42 | 11 | 23 |
I | 18 | 43 | 4 | 32 |
Also, below disconnected slicer created:
I need to create a Table visual, if I select value, "Q1 & Q2" from the below slicer, it should display only "Q1 Att" and "Q2 Att" columns from the above table. Can anyone help on that? I am using Power BI Desktop 2019 version,
Thanks in advance!
Quarters |
Q1 & Q2 |
Q2 & Q3 |
Q3 & Q4 |
Solved! Go to Solution.
create the following table :
Quarters | KEY
Q1 & Q2 |Q1
Q1 & Q2 | Q2
Q2 & Q3| Q2
Q2 & Q3 | Q3
Q3 & Q4 | Q3
Q3 & Q4 | Q4
UNPIVOT THE ABOVE THE TABLE with poewr query
steps :
step1 : select the column person
step2 : go to transform --> unpivot other columns ( near unpivot, there is a down arrow . click on it and select unpivot other columns ) ,
now you will have a table as below :
next step,
use rreplace values from power query and replace : " Att" with blank
almost there.....
now click close and apply.
create a link between the 2 tables on key -- attribute,
you are good to go .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅!
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠
Hi @patilpoonam21 ,
Based on your description,
I created some data:
Table:
Table 2:
Please try the following code to create Measure.
Q1 Measure =
IF (
CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q1" ),
SUM ( 'Table'[Q1 Att] ),
BLANK ()
)
Q2 Measure =
IF (
CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q2" ),
SUM ( 'Table'[Q2 Att] ),
BLANK ()
)
Q3 Measure =
IF (
CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q3" ),
SUM ( 'Table'[Q3 Att] ),
BLANK ()
)
Q4 Measure =
IF (
CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q4" ),
SUM ( 'Table'[Q4 Att] ),
BLANK ()
)
Measure 1 =
VAR _sel = SELECTEDVALUE('Table 2'[Quarters], "All")
RETURN
SWITCH(
_sel,
"Q1 & Q2",[Q1 Measure],
"Q2 & Q3",[Q2 Measure],
"Q3 & Q4",[Q3 Measure]
)
Measure 2 =
VAR _sel = SELECTEDVALUE('Table 2'[Quarters], "All")
RETURN
SWITCH(
_sel,
"Q1 & Q2",[Q2 Measure],
"Q2 & Q3",[Q3 Measure],
"Q3 & Q4",[Q4 Measure]
)
The field of the slicer is from Table 2. When you select "Q1 & Q2" in the slicer, Result is as below.
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @patilpoonam21 ,
Based on your description,
I created some data:
Table:
Table 2:
Please try the following code to create Measure.
Q1 Measure =
IF (
CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q1" ),
SUM ( 'Table'[Q1 Att] ),
BLANK ()
)
Q2 Measure =
IF (
CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q2" ),
SUM ( 'Table'[Q2 Att] ),
BLANK ()
)
Q3 Measure =
IF (
CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q3" ),
SUM ( 'Table'[Q3 Att] ),
BLANK ()
)
Q4 Measure =
IF (
CONTAINSSTRING ( SELECTEDVALUE ( 'Table 2'[Quarters] ), "Q4" ),
SUM ( 'Table'[Q4 Att] ),
BLANK ()
)
Measure 1 =
VAR _sel = SELECTEDVALUE('Table 2'[Quarters], "All")
RETURN
SWITCH(
_sel,
"Q1 & Q2",[Q1 Measure],
"Q2 & Q3",[Q2 Measure],
"Q3 & Q4",[Q3 Measure]
)
Measure 2 =
VAR _sel = SELECTEDVALUE('Table 2'[Quarters], "All")
RETURN
SWITCH(
_sel,
"Q1 & Q2",[Q2 Measure],
"Q2 & Q3",[Q3 Measure],
"Q3 & Q4",[Q4 Measure]
)
The field of the slicer is from Table 2. When you select "Q1 & Q2" in the slicer, Result is as below.
Best Regards,
Yulia Yan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
create the following table :
Quarters | KEY
Q1 & Q2 |Q1
Q1 & Q2 | Q2
Q2 & Q3| Q2
Q2 & Q3 | Q3
Q3 & Q4 | Q3
Q3 & Q4 | Q4
UNPIVOT THE ABOVE THE TABLE with poewr query
steps :
step1 : select the column person
step2 : go to transform --> unpivot other columns ( near unpivot, there is a down arrow . click on it and select unpivot other columns ) ,
now you will have a table as below :
next step,
use rreplace values from power query and replace : " Att" with blank
almost there.....
now click close and apply.
create a link between the 2 tables on key -- attribute,
you are good to go .
If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution ✅!
It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠