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
Roland74
Helper I
Helper I

Total on 1 column of a dimension

Hi, i've been struggling a long time with this issue, and AI can't help me.
I'm in direct-query, so i can't do anything in modeling.

I have a facttable with values, and 1 dim-table with project - main-project - projecttype and a lot of other columns.

In the facttable i have values on projects, which i want to totalize on mainproject. But in my table i want to show the project AND the main-project. A small example, this is how i want to show it in my visual but with a lot more columns.

Roland74_0-1759149846160.png

i can't seem to get it right with both the project and the mainproject in the visual.
Any suggestions?

 

1 ACCEPTED SOLUTION

Hi, Thanx for your reply.
With the sumx i don't get the 'total' row. What i need is:

Roland74_0-1759209389199.png

I Finally got it with this formula. I think it is quite long, is it possible to make this formula shorter?

Amount(with total) = 
    IF(
        HASONEVALUE(DimProject[Project]),
            SUMX (
                VALUES(DimProject[Project]),
                    IF (
                        SELECTEDVALUE(DimProject[Proj.Type]) = "Main",
                            CALCULATE(
                            SUM(FactAmount[Amount]),
                            REMOVEFILTERS(DimProject),
                            VALUES(DimProject[Main Project])
                        )
                    )
                ),
            SUMX(
                SUMMARIZE(
                    DimProject,
                    DimProject[Main Project],
                    "Amount", CALCULATE(SUM(FactAmount[Amount]))
                    ),
                    [Amount]
            )
    )

View solution in original post

7 REPLIES 7
johnt75
Super User
Super User

Try

Amount =
IF (
    SELECTEDVALUE ( 'Table'[proj type] ) = "Main",
    CALCULATE (
        SUM ( 'Table'[Amt] ),
        REMOVEFILTERS ( 'Table' ),
        VALUES ( 'Table'[Main Project] )
    )
)
Roland74
Helper I
Helper I

Great! This seams to work on the line, but how to get the right total in the Table?
Now its blank.

johnt75
Super User
Super User

You can wrap it inside a SUMX

Amount =
SUMX (
    VALUES ( 'Table'[Project] ),
    IF (
        SELECTEDVALUE ( 'Table'[proj type] ) = "Main",
        CALCULATE (
            SUM ( 'Table'[Amt] ),
            REMOVEFILTERS ( 'Table' ),
            VALUES ( 'Table'[Main Project] )
        )
    )
)

That doesn't seem to work. I've got a sample .pbix, but cannot upload it.

hello @Roland74 

 

Unless your data has workaround before the sum calculation, @johnt75 's solution should work.

Irwan_0-1759183922861.png

 

you can upload your pbix in dropbox or google drive but remember to give permission to access the pbix.

 

Thank you.

Hi, Thanx for your reply.
With the sumx i don't get the 'total' row. What i need is:

Roland74_0-1759209389199.png

I Finally got it with this formula. I think it is quite long, is it possible to make this formula shorter?

Amount(with total) = 
    IF(
        HASONEVALUE(DimProject[Project]),
            SUMX (
                VALUES(DimProject[Project]),
                    IF (
                        SELECTEDVALUE(DimProject[Proj.Type]) = "Main",
                            CALCULATE(
                            SUM(FactAmount[Amount]),
                            REMOVEFILTERS(DimProject),
                            VALUES(DimProject[Main Project])
                        )
                    )
                ),
            SUMX(
                SUMMARIZE(
                    DimProject,
                    DimProject[Main Project],
                    "Amount", CALCULATE(SUM(FactAmount[Amount]))
                    ),
                    [Amount]
            )
    )
v-tejrama
Community Support
Community Support

Hi  @Roland74 ,

 

Thank you  @Irwan  and @johnt75    for the response provided! 

Has your issue been resolved? If the response provided by the community member addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.

 

Thank you for your understanding!

 

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Users online (25)