Forum Discussion

Ed2563's avatar
Ed2563
Frequent Visitor
1 year ago
Solved

Calculate Revenue Based On Fixed AND Variable Amount

If this type of question has been posted previously, I haven't been able to find it.  I am also new to Power BI and have read Microsoft's documentation on DAX, as well as experimented with many type ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Ed2563 , hello all, thank you for your prompt reply!

    Based on the total value issue, please try as following:

     

    Adjusted Revenue = 
    
    VAR ClientID = SELECTEDVALUE(fact_clients[client_id])
    
    VAR JobCount =
    
        CALCULATE(
    
            COUNTROWS(dim_jobs),
    
            dim_jobs[client_id] = ClientID
    
        )
    
    VAR test=IF(ClientID = "be1259a7-bc71-4b30-9c42-8568874bd87b"&&JobCount>0,   // xxyyzz Client ID
           
          IF(JobCount <= 900,
    
                50000,  // $50,000 if the job count is less than or equal to 900
    
                50000 + SUM(dim_jobs[final_revenue_total]) ),
                
                SUM(dim_jobs[final_revenue_total]))  // $50,000 + the revenue for jobs above 900
    
    
    RETURN test
    TotalRevenue = SUMX(VALUES('fact_clients'[client_name]),[Adjusted Revenue])
    
    SumofTotalFinal = SUMX(VALUES(dim_dates[Date].[Month]),[TotalRevenue])
    TotalValue = 
    IF(
        ISINSCOPE(dim_dates[Date].[Month]), 
        SUMX(VALUES(fact_clients[client_name]), [Adjusted Revenue]),
        IF(
            ISINSCOPE(fact_clients[client_name]), 
            SUMX(VALUES(dim_dates[Date].[Month]), [Adjusted Revenue]),
            [SumofTotalFinal]
        )
        
    )
    

     

     Result for your reference:

     

    Best regards,

    Joyce

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

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Ed2563,

     

    Sorry for the missing month value for the date column in the DAX. I have updated the answer and pbix file above. Please check it.