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 August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Dax measure to divide some row lines to specific row lines, in a Matrix

Hello everyone,

 

I am trying to have a dax measure in a matrix, to divide all the rows to some specific rows.

I have 3 levels of hierarchy: and every row ( from the last hierarchy level) should be divided by two rows from the firs level of hierarchy.

I tried to make something like this, with the help of you, but It only works when I have only the first level of hierarcy in the matrix:

 

% of CAB =
VAR Lvl1 = SELECTEDVALUE('PL Transactions_V'[Level 1])
VAR CABCAN =
IF(Lvl1 <= "07",
CALCULATE(SUM('PL Transactions_V'[Amount]),'PL Transactions_V'[Level 1]="01. CAB- CIFRA DE AFACERI BRUTA"),
CALCULATE(SUM('PL Transactions_V'[Amount]),'PL Transactions_V'[Level 1]="06. CAN - CIFRA DE AFACERI NETA")
)
VAR _Result =
DIVIDE(SUM('PL Transactions_V'[Amount]),CABCAN)
RETURN
IF(NOT( ISBLANK(Lvl1)), _Result)
 
Untitled.jpg

7 REPLIES 7
Anonymous
Not applicable

Half Resolved with All function:

% of CAB Canal CY =
VAR Lvl1 = SELECTEDVALUE('PL Transactions Canal_Vanzari_V'[Level 1])
VAR CABCAN =
IF(Lvl1 <= "07",
CALCULATE('Measures (2)'[Amount Canal Vanzari],'PL Transactions Canal_Vanzari_V'[Level 1]="01. CAB- CIFRA DE AFACERI BRUTA",ALL('PL Transactions Canal_Vanzari_V'[Level 0], 'PL Transactions Canal_Vanzari_V'[Level 1],'PL Transactions Canal_Vanzari_V'[Level 2],'PL Transactions Canal_Vanzari_V'[Level 3])),
CALCULATE('Measures (2)'[Amount Canal Vanzari],'PL Transactions Canal_Vanzari_V'[Level 1]="06. CAN - CIFRA DE AFACERI NETA",ALL('PL Transactions Canal_Vanzari_V'[Level 0],'PL Transactions Canal_Vanzari_V'[Level 1], 'PL Transactions Canal_Vanzari_V'[Level 2],'PL Transactions Canal_Vanzari_V'[Level 3]))
)
VAR _Result =
DIVIDE('Measures (2)'[Amount Canal Vanzari],CABCAN)
RETURN
IF(NOT( ISBLANK(Lvl1)), _Result)
 
Now is working to calculate for level > 1, but not <1
Anonymous
Not applicable

adriandumitru_0-1654692701574.png

I have this error

Anonymous
Not applicable

The page is not leting me attach data table, or excel files.

Can I send it to you by email?

The included link has instructions how to paste data into a table in your post.

Anonymous
Not applicable

Hello! I hope thi is ok.

In the first capture I have column "% of CAB working"

Capture Level 1 working.PNG

 In the second capture, when I drill down to Level 2, 3 or 4, the measure is not calculating for them.

Capture Level 2,3,4 not working.PNG

No, not ok.  Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. I cannot use screenshots of your source data.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523

lbendlin
Super User
Super User

You cannot influence dataset data from measures.

 

Please provide sanitized sample data that fully covers your issue. If you paste the data into a table in your post or use one of the file services it will be easier to assist you. I cannot use screenshots of your source data.

Please show the expected outcome based on the sample data you provided. Screenshots of the expected outcome are ok.

https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.