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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.