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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jkhan
Helper III
Helper III

DAX Help

Dear Power BI Gurus,

 

Please help to build below DAX, I need to make sum based on condition on different Tables and Sum them together 

I tried to use below DAX but not working. 

 

TOTAL IFC ALL REVENUE ACTUAL = CALCULATE ( SUM(IFC_Monthly[Value]),IFC_Monthly[Category]="Revenue", IFC_Monthly[Period]="Actual"
+ SUM(CPU_Monthly[Value]),CPU_Monthly[Category]="Revenue", CPU_Monthly[Period]="Actual"
+ SUM(LOUNGE_Monthly[Value]),LOUNGE_Monthly[Category]="Revenue", LOUNGE_Monthly[Period]="Actual"
+ SUM(AIRLINES_Monthly[Value]),AIRLINES_Monthly[Category]="Revenue", AIRLINES_Monthly[Period]="Actual"
+ SUM(MD_Monthly[Value]),MD_Monthly[Category]="Revenue", MD_Monthly[Period]="Actual"
)

 

1.JPG

1 ACCEPTED SOLUTION

@jkhan 

Can you use this measure which I modified.

TOTAL IFC ALL REVENUE ACTUAL =
VAR ifc =
    CALCULATE (
        SUM ( IFC_Monthly[Value] ),
        IFC_Monthly[Category] = "Revenue",
        IFC_Monthly[Period] = "Actual"
    )
VAR cpu =
    CALCULATE (
        SUM ( CPU_Monthly[Value] ),
        CPU_Monthly[Category] = "Revenue",
        CPU_Monthly[Period] = "Actual"
    )
VAR lounge =
    CALCULATE (
        SUM ( LOUNGE_Monthly[Value] ),
        LOUNGE_Monthly[Category] = "Revenue",
        LOUNGE_Monthly[Period] = "Actual"
    )
VAR md =
    CALCULATE (
        SUM ( MD_Monthly[Value] ),
        MD_Monthly[Category] = "Revenue",
        MD_Monthly[Period] = "Actual"
    )
RETURN
    ifc + cpu + lounge + md
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

4 REPLIES 4
jkhan
Helper III
Helper III

Hi Fowmy,

 

I need aggregiate Sum from Different Tables like  IFC_Monthly CPU_Monthly LOUNGE_Monthly based on condidtion 
IFC_Monthly[Category]="Profit", IFC_Monthly[Period]="Actual"

 

2.JPG

 

 

@jkhan 

Can you use this measure which I modified.

TOTAL IFC ALL REVENUE ACTUAL =
VAR ifc =
    CALCULATE (
        SUM ( IFC_Monthly[Value] ),
        IFC_Monthly[Category] = "Revenue",
        IFC_Monthly[Period] = "Actual"
    )
VAR cpu =
    CALCULATE (
        SUM ( CPU_Monthly[Value] ),
        CPU_Monthly[Category] = "Revenue",
        CPU_Monthly[Period] = "Actual"
    )
VAR lounge =
    CALCULATE (
        SUM ( LOUNGE_Monthly[Value] ),
        LOUNGE_Monthly[Category] = "Revenue",
        LOUNGE_Monthly[Period] = "Actual"
    )
VAR md =
    CALCULATE (
        SUM ( MD_Monthly[Value] ),
        MD_Monthly[Category] = "Revenue",
        MD_Monthly[Period] = "Actual"
    )
RETURN
    ifc + cpu + lounge + md
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi Fowmy,

I used like below, Thanks for your reply. 

 

TOTAL IFC ALL PROFIT ACTUAL =
CALCULATE ( SUM(IFC_Monthly[Value]),IFC_Monthly[Category]="Profit", IFC_Monthly[Period]="Actual" )
+
CALCULATE (SUM(CPU_Monthly[Value]),CPU_Monthly[Category]="Profit", CPU_Monthly[Period]="Actual" )
+
CALCULATE (SUM(LOUNGE_Monthly[Value]),LOUNGE_Monthly[Category]="Profit", LOUNGE_Monthly[Period]="Actual" )
+
CALCULATE (SUM(AIRLINES_Monthly[Value]),AIRLINES_Monthly[Category]="Profit", AIRLINES_Monthly[Period]="Actual" )
+
CALCULATE (SUM(MD_Monthly[Value]),MD_Monthly[Category]="Profit", MD_Monthly[Period]="Actual" )

Fowmy
Super User
Super User

@jkhan 

You cannot add anything to the filter within CALCULATE like you have done + SUM ( CPU_Monthly[Value] ) .
Can you explain what is the logic that you need to apply to do the calculation also show picture of your model.




Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors