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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jlarques
Resolver II
Resolver II

Error in segmentation data

Hi everyone,

 

I defined a data segmentation rank to be able to apply some measures in my graphics, but if I don't choose any rank option, the control show me an error. 

 

The measure formula is this:Imagen11.jpg

Sales by Rank =
IF(

    ISBLANK(VALUES(RANK[RANK]));   

         BLANK();

    SUMX(
         FILTER(
              VALUES( CLIENTES[CLI_NOM]);
              [TotalSales]>=VALUES(RANK[FROM]) && [TotalSales]<=VALUES(RANK[TO) );
[TotalSales] ) )

1 ACCEPTED SOLUTION
jlarques
Resolver II
Resolver II

Hi everyone,

 

finally, I have the right formula to be able let the rank in blank if the user doesn't choose any option. The key was the command SELECTEDVALUE instead of VALUES. Here is the right formula:

Rank x Customers =
IF(SELECTEDVALUE(

      RANK[RANK])=BLANK();

      SUMX(
          FILTER(
              VALUES( CUSTOMERS[CUSTOMERNAME]);
                    [TotalSales]>=0 && [TotalSales]<=1000) ;
                    [TotalSales] );

    SUMX(
        FILTER(
            VALUES( CUSTOMERSCUSTOMERNAME]);
                 [TotalSales]>=VALUES(RANK[FROM]) && [TotalSales]<=VALUES(RANK[TO]) );
                 [TotalSales] ) )

If the user doesn't choose anything and the RANK[RANK] is blank, using SELECTEDVALUES I assign the first option(Until 1.000€) applying TotalSales between 0 and 1000.

 

Thanks everybody for its contributions to this community.

 

 

View solution in original post

3 REPLIES 3
jlarques
Resolver II
Resolver II

Hi everyone,

 

finally, I have the right formula to be able let the rank in blank if the user doesn't choose any option. The key was the command SELECTEDVALUE instead of VALUES. Here is the right formula:

Rank x Customers =
IF(SELECTEDVALUE(

      RANK[RANK])=BLANK();

      SUMX(
          FILTER(
              VALUES( CUSTOMERS[CUSTOMERNAME]);
                    [TotalSales]>=0 && [TotalSales]<=1000) ;
                    [TotalSales] );

    SUMX(
        FILTER(
            VALUES( CUSTOMERSCUSTOMERNAME]);
                 [TotalSales]>=VALUES(RANK[FROM]) && [TotalSales]<=VALUES(RANK[TO]) );
                 [TotalSales] ) )

If the user doesn't choose anything and the RANK[RANK] is blank, using SELECTEDVALUES I assign the first option(Until 1.000€) applying TotalSales between 0 and 1000.

 

Thanks everybody for its contributions to this community.

 

 

v-shex-msft
Community Support
Community Support

Hi @jlarques,

 

Values function will return a list from selected value, it will return error when you try to use math symbol to compare with list of value.(at row level, values return single value, but on total/summary level, it contains multiple values)

 

I add firstnonblank and lastnonblank to extract single value from list, maybe you can try it if it suitable for your requirement:

Sales by Rank =
IF (
    ISBLANK ( VALUES ( RANK[RANK] ) );
    BLANK ();
    SUMX (
        FILTER (
            VALUES ( CLIENTES[CLI_NOM] );
            [TotalSales] >= FIRSTNONBLANK ( VALUES ( RANK[FROM] ); [FROM] )
                && [TotalSales] <= LASTNONBLANK ( VALUES ( RANK[TO] ); [TO] )
        );
        [TotalSales]
    )
)

If above not help, please share some sample data to test.

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hi Xiaoxin,

 

Rango facturación.jpgVentas por cliente.jpgthanks for your comments but the formula is not working. In the Sales by Rank I only have a Measure TotalSales(TotalSales=SUM(DATOS[IMPORTE]) and the customer name. When I choose one of the Rank options in the Rank amount, it works, as you can see in the images attached. The problem is when I don't choose anything in the Rank options.

 

Maybe would be a good option to have always the first option choosed. I don't know if this is possible or not. 

 

Thanks again for your help.

 

 

Jose Luis

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.