Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Dynamic measure related to a specific filter

Hi all,

 

I'm a new Power BI user and my skills in DAX are limited 😞

 

I have a table with multiples lines and columns. I want to show and count the number of lines, in my visual, based on one or another column depending on a specific filter. 

Sans titre.png

 

My first table is named "Accounts" with the following columns (text)

 Capture.PNG

 

My filter table is names "Disconnected"

Capture2.PNG

 

I need to show the text (Rhumato, Cardio etc) and count the number of lines (not blank) of the column :

- "Segment R1" if I choose "R1"

- "Segment R2" if I choose "R2"

- "Segment R3" if I choose "R3"

- "Segment H1" if I choose "H1"

- "Segment H2" if I choose "H2"

 

My measures can be modified by others filters (I'm using CALCULATE as well).

 

I need also to creat another dynamic measure for number format (functions CALCULATE and COUNTX used for theses columns) :

- Frequence R1

- Frequence R2

- Frequence R3

- Frequence H1

- Frequence H2

 

 

I've found the following topic (and some others) but it doesn't work 😞 I guess i did something wrong 

https://www.fourmoo.com/2017/11/21/power-bi-using-a-slicer-to-show-different-measures/

 

Someone can help me?

Thanks in advance.

1 ACCEPTED SOLUTION
jrmoore
Frequent Visitor

Here is a great video to show you how to do this with a disconnected table. The SWITCH statement will be the key to creating this measure.

https://www.youtube.com/watch?v=gEeiqsm7BaY

 

Thanks

Jarrett

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi @jrmoore ,

 

Thank you for the video. I will check it and try the solution.

I will let you (@jrmoore  and @v-piga-msft) if I solve my problem or need more help.

 

 

Thank your

Kind regards,

ErsinOK

Anonymous
Not applicable

Hi all,

 

I've tried the solution on the video and it's working! Thank you for your help.

 

Just an additonnal question : Can I use it with a mesure based on COUNTX (at the place of [Nb ciblés R1/R2/R3 ...]?

 

Value Selection =
VAR Selection =SELECTEDVALUE(Disconnected[Reseau];"All")
RETURN
SWITCH(TRUE();
Selection="R1";[Nb ciblés R1];
Selection="R2";[Nb ciblés R2];
Selection="R3";[Nb ciblés R3];
Selection="H1";[Nb ciblés H1];
Selection="H2";[Nb ciblés H2];
[Nb ciblés H1])

 

KR

Yes, that measure should work!

 

Thanks

Jarrett

Anonymous
Not applicable

So how? I cannot fix it ...

 

I have multiples values (text) for each column. For example :

- Segment R1 :

          Val A

          Val B

          Val C

- Segment R2 :

          Val D

          Val E

          Val F

 etc for "Segmentation R3/H1/ and H2".

 

I would like to use my first measure (dynamic selection), and count the number of lines in additon with filter based on my values "Segmentation R1/R2/R3/H1 and H2" (Val A, B, C, D etc ...).

 

I can't use my first DAX measure to fix it ?

 

 

Thank you for your help.

EO

If you need to add more than one item to each line of your measure just use the && to add the other Value in the selection. Not sure if i completely understand your question. If this doesn't answer your question, please give more examples from your data on which columns and or measures will be used in the SWITCH statement.

 

Thanks

Jarrett

 

 
 

 

 
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

Have you solved your problem?

If you have solved your problem, please always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

If you still need help, please share your data sample with table format and your desired output so that we could copy and test.

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jrmoore
Frequent Visitor

Here is a great video to show you how to do this with a disconnected table. The SWITCH statement will be the key to creating this measure.

https://www.youtube.com/watch?v=gEeiqsm7BaY

 

Thanks

Jarrett

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.