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
DLJ
Frequent Visitor

Using IF Function over Net Subtotals

Hi all,

 

I would be very grateful if somebody can help me.

 

I have an issue when using function IF as follows:

 

'EQUITY AJUSTED = (SUMX(Global_Table;IF([Measure_1] > 0;

([Measure_2]*RELATED('Specific_Table'[Column_1]))+[Measure_1];

([Measure_2]*RELATED('Specific_Table'[Column_1])

 

My problem is the following:

I want to use the IF function ([Measure_1] > 0) over the subtotal (Measure_1) of the first level of the hierarchy, because such function IF has sense using it over the net subtotal, but not over the detailed accounts if I drill down in the matrix.

 

If I drilled down expanding the table (second level of the hierarchy), I can find several rows below with different figures (Measure_1) which may be higher or lower than 0. With my formula, I can see that my IF function is operating and calculating the result differently row by row (but It has no sense if it is not the net subtotal).

 

What is what I want to get?

If the net subtotal (Measure_1) is > 0; do for all rows ([Measure_2]*RELATED('Specific_Table'[Column_1])+[Measure_1])

 

Else; do for all rows ([Measure_2]*RELATED('Specific_Table'[Column_1])

 

Is it possible? Any alternative solution?

 

Thank you so much in advanced.

 

Regards

 

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@DLJ 

 

You may check if the posts below help.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-chuncz-msft
Community Support
Community Support

@DLJ 

 

You may check if the posts below help.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
Super User
Super User

Thank you for the tip!

 

Using ISINSCOPE function, I think I am closer to the solution (thanks!), but I do not having yet.

 

This is is the progress:

I have identified with "TRUE" the level of the hierarchy in which I want to use the IF function.

ISINSCOPE PROMOCION LEVEL IS TRUE = IF(ISINSCOPE(dimPARTIDAS[APARTADO PRINEX]);FALSE();TRUE())
 
So I would like to use IF function over subtotals in such level. E.g:
EQUITY ISINSCOPE = IF([ISINSCOPE PROMOCION LEVEL IS TRUE]=TRUE(); ...
But I don't have the right calculate.
 
In my current formula I am using also SUMX and that is the problem I think (because I guess this is the reason why the result I am getting is a Total Sum of the operations (IF function) row by row. I just need the calculate in my level chosen over the net subtotals (not row by row).

 

Maybe, a solution would to calculate separately the net results of each measure for the "TRUE" level and afterwards do the IF function.

 

Thanks again

 

DLJ
Frequent Visitor

By the way, my current formula would be:

 

EQUITY ISINSCOPE = IF([ISINSCOPE PROMOCION LEVEL IS TRUE]=TRUE();
CALCULATE(SUMX(fctPPTOS;IF([EQUITY NECESARIO % GASTOS FINANCIABLES]>0;...;...)))
 
Thanks!

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.