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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Hrenechen
New Member

DAX in PIVOT to Return one valor of the Exclusion

Hello There!
I need a hand in this problem:
General Context: The company ask me to creat in Excel a Sheet for the use of ours selling team, and for this I'm using Query, Pivote and Visualization.
Problem Context: There is some Measures, like the one down bellow, that some of the ID's cant be considered, as they are the Team Leaders, T.I Support and its Testes or even some other non comercial seller, so my sollution was: Creat a range of ID's that I would with the function "IF" transfor in blank.

THE PROBLEM: It in indeed work, but only if the Team leaders are filtered, so if I want to see every one of the sector, I Cant, as the Excel return the saying: 

-----------------------------------------------------------------------------------------------------------------------------------------------

"MdxScript(Model) (17,58) Error in the measure calculation 'dMeta'[Positivação (Und)]]: A table of many values was delivered, and only one value was expected."*

-----------------------------------------------------------------------------------------------------------------------------------------------

*Free translation of portuguese to english


Hrenechen_0-1685460549917.png

 

This one bellow is my DAX (in Pivot), some terms that are in portuguese to english:

 

Hrenechen_2-1685461353301.png

 

 

 

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @Hrenechen ,

Please update the formula of calculated column [Goal Positivation (Und)] as below and check if it can return the expected result...

Goal Positivation (Und) :=
VAR POSITIVwACTIVES =
    SUMX ( dGoal, dGoal[Positivation (%)] * [Active Base] )
VAR CodException =
    MAX ( RcaException[ID.RCA Exception] )
RETURN
    IF (
        POSITIVwATIVOS = 0
            || ISBLANK ( POSITIVwATIVOS )
            || CONTAINS ( dMeta, [ID.RCA], CodException ),
        BLANK (),
        DIVIDE ( POSITIVwACTIVES, [Active Base], BLANK () )
    ) * [Active Base]

If the above one can't help you, please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. Also please provide the related info if there is any relationship among these tables. It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

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

View solution in original post

2 REPLIES 2
Hrenechen
New Member

Rena, thank you!
Your sollution work fine, and my problem is solved, I will make sure to read your links about the best pratices for the comunity!
Be bless!

v-yiruan-msft
Community Support
Community Support

Hi @Hrenechen ,

Please update the formula of calculated column [Goal Positivation (Und)] as below and check if it can return the expected result...

Goal Positivation (Und) :=
VAR POSITIVwACTIVES =
    SUMX ( dGoal, dGoal[Positivation (%)] * [Active Base] )
VAR CodException =
    MAX ( RcaException[ID.RCA Exception] )
RETURN
    IF (
        POSITIVwATIVOS = 0
            || ISBLANK ( POSITIVwATIVOS )
            || CONTAINS ( dMeta, [ID.RCA], CodException ),
        BLANK (),
        DIVIDE ( POSITIVwACTIVES, [Active Base], BLANK () )
    ) * [Active Base]

If the above one can't help you, please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. Also please provide the related info if there is any relationship among these tables. It would be helpful to find out the solution. You can refer the following links to share the required info:

How to provide sample data in the Power BI Forum

 

And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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