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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ribisht17
Super User
Super User

MINX with Temp Table

Hello Community, 

 

I want to show Scores from different location and then pick the one with the lowest score.

 

Actually I need to show this via Bar Chart hence needed a temp table to show the overall minimum bar (I know with tables we can directly get the min values)

 

Location_Temp =
UNION(
    VALUES(Dim_Employee[Location]),
    ROW("Location", "Overlall Minimum")
)

 

1st way (working)

 

Location_Score_Summary =
SUMMARIZE(
    Fact_Employee_Training,
    Dim_Employee[Location],
    "Total Score", SUM(Fact_Employee_Training[Score])
)
 
 
test_minx = if( CONTAINSSTRING( MIN(Location_Temp[Location]),"Over"),
 
MIN(Location_Score_Summary[Total Score]),
CALCULATE(SUM(Fact_Employee_Training[Score])))
 
 
-----------------------------------------------------------------------------------------------------------------------------------------
2nd way (not working)
 
 
 test_minx_fixed =
IF(
    CONTAINSSTRING(SELECTEDVALUE(Location_Temp[Location]), "Over"),
    MINX(
        VALUES(Dim_Employee[Location]),
        CALCULATE(SUM(Fact_Employee_Training[Score]))
    ),
    CALCULATE(
        SUM(Fact_Employee_Training[Score]),
        Dim_Employee[Location] = SELECTEDVALUE(Location_Temp[Location])
    )
)
 
 Why second way gives me blank there?

ribisht17_3-1761618126450.png

 

ribisht17_2-1761617912632.png

 

Why it is not working for the second way ?

 

Regards,

Ritesh

 

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

Please try something like below.

 

test_minx_fixed = 
IF(
    CONTAINSSTRING(SELECTEDVALUE(Location_Temp[Location]), "Over"),
    MINX(
        FILTER(ALL(Location_Temp[Location]), Location_Temp[Location] <> "Overall Minimum"),
        CALCULATE(SUM(Fact_Employee_Training[Score]))
    ),
    CALCULATE(
        SUM(Fact_Employee_Training[Score]),
        Dim_Employee[Location] = SELECTEDVALUE(Location_Temp[Location])
    )
)

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

4 REPLIES 4
Shahid12523
Community Champion
Community Champion

Your second formula returns blank because MINX lacks row context—CALCULATE(SUM(...)) isn’t filtered per location. Also, CALCULATE(..., Dim_Employee[Location] = ...) is invalid syntax unless wrapped in a FILTER().

 

Fix: Use FILTER() inside MINX to apply location context:

 

MINX(
VALUES(Dim_Employee[Location]),
CALCULATE(
SUM(Fact_Employee_Training[Score]),
FILTER(
ALL(Dim_Employee),
Dim_Employee[Location] = EARLIER(Dim_Employee[Location])
)
)
)

Shahed Shaikh

Thanks Shahid,

 

Unfortunately your solution is not working 

(update)
However, the same DAX works here

ribisht17_0-1761629435202.png

 

 

Regards,

Ritesh

Jihwan_Kim
Super User
Super User

Hi,

Please try something like below.

 

test_minx_fixed = 
IF(
    CONTAINSSTRING(SELECTEDVALUE(Location_Temp[Location]), "Over"),
    MINX(
        FILTER(ALL(Location_Temp[Location]), Location_Temp[Location] <> "Overall Minimum"),
        CALCULATE(SUM(Fact_Employee_Training[Score]))
    ),
    CALCULATE(
        SUM(Fact_Employee_Training[Score]),
        Dim_Employee[Location] = SELECTEDVALUE(Location_Temp[Location])
    )
)

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi @Jihwan_Kim 

 

Great this is working,accepting this as Solution , but I am still not sure why the below is not working ?

   MINX(

        VALUES(Dim_Employee[Location]),
        CALCULATE(SUM(Fact_Employee_Training[Score]))
    )

 

Same DAX is working in the below scenario

ribisht17_1-1761629483339.png

 



Regards,

Ritesh

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI 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.

Top Solution Authors
Top Kudoed Authors