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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
HemanthV
Helper II
Helper II

Current category count subtract with remaining categories count

Hi Guys,
I have the data as below
NamescyclesDate

A-101-01-2020
A-102-01-2020
A003-01-2020
A104-01-2020
A105-01-2020
A105-01-2020
A106-01-2020
A107-01-2020
A108-01-2020
A108-01-2020
A109-01-2020
A210-01-2020
A211-01-2020
A311-01-2020
A411-01-2020
B001-01-2020
B002-01-2020
B103-01-2020
B104-01-2020
B105-01-2020
B105-01-2020
B106-01-2020
B108-01-2020
B108-01-2020
B109-01-2020
B110-01-2020
B211-01-2020
B211-01-2020
B311-01-2020
B311-01-2020
B311-01-2020
C-101-01-2020
C002-01-2020
C003-01-2020
C004-01-2020
C105-01-2020
C105-01-2020
C106-01-2020
C108-01-2020
C108-01-2020
C109-01-2020
C110-01-2020
C211-01-2020
C311-01-2020

 

I am populating this data in a matrix visual which will look like

HemanthV_0-1624449094430.png

Now my requirement is that from column 1 to 4
the current value needs to be subtracted from the sum of next columns.
for example:
For A i have 8 in [1] column, 8 - (2+1+1)  = 4 will be displayed in [1] instead of 8. so for A the values will be 2,1,4,0,0,1

The values of A are 2,1,8,2,1,1 updated values will be 2,1,8-(2+1+1),2-(1+1),1-1,1

the values of 0 and -1 won't change only substraction will be done for columns 1 to 4

Expected output

HemanthV_1-1624452222373.png

I am attaching sample pbix 

https://drive.google.com/file/d/13lB30RroIeOKyiptiif181iWvD-eFyWn/view?usp=sharing

 

Please help me on this guys..!!!

Thanks in Advance!

@parry2k , @amitchandak 

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

https://www.dropbox.com/s/xgf8cztetxl562t/Sample.pbix?dl=0 

 

Expected Output : =
VAR currentcycle =
MAX ( 'Dim Cycles'[cycles] )
VAR countrownormal =
COUNTROWS ( Table1 )
VAR countrowcondition =
countrownormal
- CALCULATE (
COUNTROWS ( Table1 ),
FILTER ( ALL ( 'Dim Cycles' ), 'Dim Cycles'[cycles] > currentcycle )
)
RETURN
IF ( currentcycle <= 0, countrownormal, countrowcondition )

 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

 

https://www.dropbox.com/s/xgf8cztetxl562t/Sample.pbix?dl=0 

 

Picture1.png

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

11 REPLIES 11
Jihwan_Kim
Super User
Super User

https://www.dropbox.com/s/xgf8cztetxl562t/Sample.pbix?dl=0 

 

Expected Output : =
VAR currentcycle =
MAX ( 'Dim Cycles'[cycles] )
VAR countrownormal =
COUNTROWS ( Table1 )
VAR countrowcondition =
countrownormal
- CALCULATE (
COUNTROWS ( Table1 ),
FILTER ( ALL ( 'Dim Cycles' ), 'Dim Cycles'[cycles] > currentcycle )
)
RETURN
IF ( currentcycle <= 0, countrownormal, countrowcondition )

 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi @Jihwan_Kim ,

The solution worked but the column totals  are showing wrong

HemanthV_0-1624457206119.png

instead of 8,8,10 it is displaying 15,16,13. can you help me with this

 

Thanks in advance!

@HemanthV 

Thank you for the feedback.

Please check the link down below.

 

Picture1.png

 

https://www.dropbox.com/s/xgf8cztetxl562t/Sample.pbix?dl=0 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi @Jihwan_Kim ,

Thank you so much! But i am curious that is it possible to find the percentages for values.
I will use this percentages in another matrix.

HemanthV_1-1624459058644.png

 

I am using the following measure for percentage

 
Percentage_new =
var cnt = [Expected Output :]
var totalcnt = CALCULATE(COUNT(Table1[cycles]),ALL(Table1[cycles]))
var percentage = DIVIDE(cnt,totalcnt)*100
return
percentage

Sorry that I quite do not understand what you are looking for.

 

Is  [percentage_new] showing the result that you expected? 

What is your expected outcome?


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

@Jihwan_Kim 

I want to see percentage for the values

HemanthV_0-1624460956412.png

In the above pic
each value should be divided by total right for percentage
for example 
for "A" the percentages are 25,12.5,50,0,0,12.5 right, but i am getting wrong values.

2/8*100,  1/8*100,  4/8*100,  0/8*100,  0/8*100,  1/8*100

 

can you help me with this.

 

https://www.dropbox.com/s/xgf8cztetxl562t/Sample.pbix?dl=0 

 

Picture1.png

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi @Jihwan_Kim,

The solution worked but, i am struggling to get this. currently we are showing the percentages for all values right. excluding -1 values it should consider only values from zero to 4 and that is the total, and the percentages need to be shown as below

expected output:

HemanthV_2-1624537590021.png

 

Thanks in advance!

 

https://www.dropbox.com/s/xgf8cztetxl562t/Sample.pbix?dl=0 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi @Jihwan_Kim ,
I need some help from you. 

HemanthV_0-1625499673710.png
I need -1 to 6 columns in one table and:

1) For -1, I need Cycle table count.

2) from 0 to 6 I need which_day table count

Thanks in advance!

Hi @Jihwan_Kim,

Thank you so much for helping me out! It Worked.

 

Thanks a lot..!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors