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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
ksahil16
Frequent Visitor

Dynamic column value change (rows) according to date slicer to calculate the count,

Hello,

 

I have a table which looks something like this:

 

CategoryImportanceweightDate
Alow22016
Alow22017
Av .low12018
Amedium32020
Blow22019
Bmedium32020
Chigh42017
Clow22020
Dv  high5

2021


I want to create a column which creates the count for number of rows per Category per Importance.

CategoryImportanceweightDateCount
Alow220162
Alow220172
Av .low120181
Amedium320201
Blow220172
Blow220202
Chigh420172
Chigh420202
Dv  high5

2021

1



This is something I can get using : 

Count =
CALCULATE(
    COUNTROWS(Table),
    ALLEXCEPT(Table, Table[Category], Table[Importance])
)

but if I select the slicer for Date from 2018, the numbers should change and the table should become like this:



CategoryImportanceweightDateCount
Av .low120181
Amedium320201
Blow220201
Chigh420201
Dv  high5

2021

1



as you can see we only have data from 2018 and also the Count has changed, this is something that I am not able to achieve for calculated columns. The Count still remains the (B, low) as 2, as it was calculated on the entire column in the previous formula. How can i make the Count column dynamic according to the slicer, which changes the count of rows.

NOTE: I have also tried to this in measure, with success, also after calculating the desired column and carrying on with all the after calculations to get myself entually 3 points in my measure column which I would like to plot. but when I try to plot it, it gives me directly the aggregate, so I am opted back to calculated column.

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@ksahil16 I'm still not clear what you are trying to achieve but did you use category column on the legend? I'm sure I'm missing something here but don't know what that is?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

4 REPLIES 4
parry2k
Super User
Super User

@ksahil16 I'm still not clear what you are trying to achieve but did you use category column on the legend? I'm sure I'm missing something here but don't know what that is?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hello @parry2k , How could I miss this, putting Category column in the Legend actually solved it. I knew I was doing everything right in terms of calculations but was missing this step. 

Thank you for the help and reading through my post patiently.

parry2k
Super User
Super User

@ksahil16 not sure why to create a calculated column, the best practice should be to create a measure.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hello @parry2k ,

I did create Measure for the calculation, to give an example:

Count = CALCULATE(COUNT('Table'[Category]))

to follow that I also create one more column in form of "Measures", Count_x_weight

 

CategoryImportanceweightDateCountCount_x_weight
Av .low1201811
Amedium3202013
Blow2202012
Chigh4202014
Dv  high5

2021

15

 

Considering the same thing, I created two more Measures - Count_sum (sum of the Count column), Count_x_weight_sum (sum of the Count_x_weight).

My final measure was Point_to_plot - (Count_x_weight_sum) / Weight_sum

 

CategoryWeight_sumCount_x_weight_sumPoint_to_plot
A242
B122
C144
D155



Here I recieve the final Measure I want to plot, but when I try to plot this on a scatter plot as my X- axis I only get one point, which is the aggregation 3.25. I would like to have 4 point representing 4 categories, but as I was not able to visualize that using Measure i thought of doing it in calculated columns.

How do I visualize the Point_to_plot for every Category?

NOTE: Please note that when I apply the Date slicer the number of rows change and every calculation changes.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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