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
Ricardo77
Helper II
Helper II

Using Calculate inside SUMX to get a calculation -> Parameter is not the correct type

Hello,

inside SUMX i'm iterating over a FACTUAL, doing something like (x/a)*(a'-a), where a' is DIMENSION(SOMEVALUE2) under a different context CODE_MOMENT_T_1 (all the other "code" runs under CODE_MOMENT).

So i think that line could also be something like 
CALCULATE(RELATED(DIMENSION[SOMEVALUE2]); FACTUAL[CODEMOMENT] = CODEMOMENT_T)

but the moment i do this, RELATED(DIMENSION[SOMEVALUE2]) gets underlined and i got an error message saying "Parameter is not the correct type. Cannot find name [SOMEVALUE2]"

 

RESULT  = 
VAR SELECTED_2_MOMENTS = ALLSELECTED(FACTUAL[CODEMOMENT])
VAR CODEMOMENT_T =   CALCULATE(MAX(FACTUAL[CODEMOMENT]); FACTUAL[CODEMOMENT] IN SELECTED_2_MOMENTS) 
VAR CODEMOMENT_T_1 = CALCULATE(MIN(FACTUAL[CODEMOMENT]); FACTUAL[CODEMOMENT] IN SELECTED_2_MOMENTS)

RETURN IF (CODEMOMENT_T <> SELECTEDVALUE(FACTUAL(CODEMOMENT); 
            CALCULATE (
                SUMX(
                    FACTUAL;        
                    DIVIDE(FACTUAL[SOMEVALUE]; RELATED(DIMENSION[SOMEVALUE2])) 
                    *
                    -- calculation problem next line 					
                    
(CALCULATE(MAX(DIMENSION[SOMEVALUE2]); FACTUAL[CODEMOMENT] = CODEMOMENT_T; CROSSFILTER(FACTUAL[ID_CONCATENATED_ENTRY]; DIMENSION[ID_CONCATENATED_ENTRY]; OneWay))
		  
                    - RELATED(DIMENSION[SOMEVALUE2]))  
                    ;
                    FACTUAL[CODEMOMENT] = CODEMOMENT_T_1)
           )            

 

Can someone help me out?

 

 

 

2 REPLIES 2
amitchandak
Super User
Super User

@Ricardo77 , Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello @amitchandak , thanks for your help & time,

to be sincere, i already posted the question with more detail , under this link
https://community.powerbi.com/t5/DAX-Commands-and-Tips/How-to-get-the-value-from-the-same-table-but-...

If you could help i would be very thankful (Y)

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.