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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
jamc
Frequent Visitor

DAX PROBLEM

Hi guys 

 

I am looking for a Dax Solution for the current predicament I have created a table where all the information is previoulsy extracted and calculated from their corresponding tables to the current view. Currently this how is dispay in my PBI

 

jamc_0-1681350588970.png

Now the next step under Column Status I want to identify the opportunity If the excess of one Company (column in blue) is < the shortage of the others companies column Yellow,

 

I tried to nest the information by using th If Function and even try the Switch(true() function without succes, hope that you can helop me display the data

 

Kind Regards

 

 

1 ACCEPTED SOLUTION
Wilson_
Super User
Super User

Hello jamc,

 

Knowing nothing about your data model, something like the below should work. I assumed that excess/shortage were measures and that company was a column in the table. Adjust the measure as necessary.

 

Status =
VAR CompanyAExcess =
CALCULATE (
    [Excess],
    REMOVEFILTERS ( Table1[Company] ),
    Table1[Company] = "Company A"
)
VAR CompanyBShortage =
CALCULATE (
    [Shortage],
    REMOVEFILTERS ( Table1[Company] ),
    Table1[Company] = "Company B"
)
VAR CompanyCShortage =
CALCULATE (
    [Shortage],
    REMOVEFILTERS ( Table1[Company] ),
    Table1[Company] = "Company C"
)

RETURN
IF (
    CompanyAExcess <= MAX ( CompanyBShortage, CompanyCShortage ),
    "Opportunity"
)


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
Wilson_
Super User
Super User

Hello jamc,

 

Knowing nothing about your data model, something like the below should work. I assumed that excess/shortage were measures and that company was a column in the table. Adjust the measure as necessary.

 

Status =
VAR CompanyAExcess =
CALCULATE (
    [Excess],
    REMOVEFILTERS ( Table1[Company] ),
    Table1[Company] = "Company A"
)
VAR CompanyBShortage =
CALCULATE (
    [Shortage],
    REMOVEFILTERS ( Table1[Company] ),
    Table1[Company] = "Company B"
)
VAR CompanyCShortage =
CALCULATE (
    [Shortage],
    REMOVEFILTERS ( Table1[Company] ),
    Table1[Company] = "Company C"
)

RETURN
IF (
    CompanyAExcess <= MAX ( CompanyBShortage, CompanyCShortage ),
    "Opportunity"
)


----------------------------------
If this post helps, please consider accepting it as the solution to help other members find it quickly. Also, don't forget to hit that thumbs up and subscribe! (Oh, uh, wrong platform?)

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.