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
LeaRupnik
Helper III
Helper III

exemple sum

Hello, 

 

i have a problem, with sum and thant vhat a have too give in a table in powerBI. 

I have a formula in SSAA:

PLAN NAB PREMIJA VRED:=CALCULATE([SumPlan_nab_premija]*[SumPlan_kol]/1000;
FILTER ( ALL ('cisppr cista_prodajna_premija'); 'cisppr cista_prodajna_premija'[datum_posnetka] = MAX('cisppr cista_prodajna_premija'[datum_posnetka]));
VALUES('cisppr cista_prodajna_premija'[Nivo 1]);
VALUES('cisppr cista_prodajna_premija'[Nivo 2]);
VALUES('cisppr cista_prodajna_premija'[Nivo 3]);
VALUES('cisppr cista_prodajna_premija'[Nivo 4]);
VALUES('cisppr cista_prodajna_premija'[mesec]);
VALUES('cisppr cista_prodajna_premija'[leto])
)

 

than table in PowerBI:

LeaRupnik_0-1605851065736.png

the nivo 4 is ok, nivo 3, nivo 2 and nivo 1 a would like that is sum nivo 3 sum (nivo4) and so one. 

 

Please help. 

 

thx

LEa

 

 

4 REPLIES 4
d_gosbell
Super User
Super User

This sounds like an order of operations issue. Currently the code is summing the two measures, then doing the multiplication and division and it sounds like you want it to do the multiplication and division first then sum up the results.

 

You could achieve this by doing a SUMX over the values in [Sistem naziv enote] (assuming that is the lowest level that you want the values calculated at)

 

eg.

 

REAL NAB PREMIJA VRED v2 = 
var maxDatum = MAX('fact (2)'[datum_posnetka])
return CALCULATE(
    SUMX( VALUES('fact (2)'[Sistem naziv enote]),
    [SumReal_nab_premija]*[REAL NAB KOL]/1000)
        , 'fact (2)'[datum_posnetka] = maxDatum )

 

LeaRupnik
Helper III
Helper III

I have a very big data model (data are secure). My question is how to use different formula (measure- DAX) in the same column for different levels.

 

thx

Lea

v-xuding-msft
Community Support
Community Support

Hi @LeaRupnik ,

 

Can you please share some sample data? We will understand your requirement more clearly. Thanks!

 

Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.