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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Hamdiboumlik_CP
New Member

MdxScript(Model) (283, 35) Erreur de calcul dans la mesure «Dim_Mesures»[Agence_Filtered] : Summariz

I have the function below: when I use Power BI Desktop, it works fine and displays the results. However, when I tried to publish my report to Power BI Service, I encountered the error message mentioned in the title : 

DAX CODE : 

Agence_Filtered =
VAR TRO_Value = [TRO]
VAR AgenceCummuleCollecte = COUNTROWS(SUMMARIZECOLUMNS('Dim_Cartographie'[Agences], "TRO_Filtered", 'Dim_Calendar'[TRO_Filtered]))
VAR AgenceCummuleDecollecte = [Total_Ag_Decollecte_Cumule]
VAR SelectedPlage = SELECTEDVALUE(PlagesTRO[Plage])

RETURN
    SWITCH(
        SelectedPlage,
        "<0%", IF(TRO_Value < 0, AgenceCummuleDecollecte),
        "0-25%", IF(TRO_Value >= 0 && TRO_Value <= 0.25, AgenceCummuleCollecte),
        "25-50%", IF(TRO_Value > 0.25 && TRO_Value <= 0.5, AgenceCummuleCollecte),
        "50-75%", IF(TRO_Value > 0.5 && TRO_Value <= 0.75, AgenceCummuleCollecte),
        "75-100%", IF(TRO_Value > 0.75 && TRO_Value <= 1, AgenceCummuleCollecte),
        ">100%", IF(TRO_Value > 1, AgenceCummuleCollecte),
        BLANK()
    )
1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

is TRO_Filtered a measure or a column? Try this

 

VAR AgenceCummuleCollecte = COUNTROWS(SUMMARIZECOLUMNS('Dim_Cartographie'[Agences],  'Dim_Calendar'[TRO_Filtered]))

View solution in original post

2 REPLIES 2
v-yilong-msft
Community Support
Community Support

Hi @Hamdiboumlik_CP ,

I’d like to acknowledge the valuable input provided by @lbendlin . His initial ideas were instrumental in guiding my approach. However, I noticed that further details were needed to fully understand the issue.  

In my investigation, I took the following steps:

 

I think the problem may be related to the context in which the SUMMARIZECOLUMNS function is used, or to the way the SELECTEDVALUE function interprets the selected value in Power BI Service.

 

So I think you first need to have the relationship between the "Dim_Cartographie", "Dim_Calendar" and "PlagesTRO" tables set up correctly. You can also test the SUMMARIZECOLUMNS part of the formula separately to make sure it returns the expected results. You can also look at this topic: Solved: MdxScript(Model) (5, 44) Calculation error in meas... - Microsoft Fabric Community

 

 

 

Best Regards

Yilong Zhou

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

lbendlin
Super User
Super User

is TRO_Filtered a measure or a column? Try this

 

VAR AgenceCummuleCollecte = COUNTROWS(SUMMARIZECOLUMNS('Dim_Cartographie'[Agences],  'Dim_Calendar'[TRO_Filtered]))

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

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