Forum Discussion

admin11's avatar
admin11
Icon for Memorable Member rankMemorable Member
4 years ago
Solved

Why my GP% table only display 1st column only ?

Hi All

 

Below expression is work well for Table 1 sales:-

 
_Segment sales_SGD = CALCULATE([SALES SGD],
FILTER(ADDCOLUMNS(VALUES(SALES[Customer Name]),
"ABCD",CALCULATE(divide([SALES SGD],'RATE'[_rate]),CALCULATETABLE(VALUES(SALES[Customer Name])))),
COUNTROWS(FILTER(Brackets,
[abcd]>=Brackets[ Lower ]&&[ABCD]<=Brackets[ Upper ]))>0))
 

 

Below expression is work well for Table 2 Cost:-

 
_Segment COST_SGD = CALCULATE([COST SGD_],
FILTER(ADDCOLUMNS(VALUES(SALES[Customer Name]),
"ABCD",CALCULATE(divide([COST SGD_],'RATE'[_rate]),CALCULATETABLE(VALUES(SALES[Customer Name])))),
COUNTROWS(FILTER(Brackets,
[abcd]>=Brackets[ Lower ]&&[ABCD]<=Brackets[ Upper ]))>0))
 
 

 

I try to create expression below for GP% :-

_Segment GP_SGD = CALCULATE([SALES GP%],
FILTER(ADDCOLUMNS(VALUES(SALES[Customer Name]),
"ABCD",CALCULATE(divide([SALES GP%],'RATE'[_rate]),CALCULATETABLE(VALUES(SALES[Customer Name])))),
COUNTROWS(FILTER(Brackets,
[abcd]>=Brackets[ Lower ]&&[ABCD]<=Brackets[ Upper ]))>0))
 

 

The above table is problem , because it only display first column GP% , the 2nd and 3 th column missing.

 

PBI sample file :-

https://www.dropbox.com/s/jgwxjq2dgi7908b/DATA_TI_TA_CLASS%20TABLE%20GP%20PERCNTAGE.pbix?dl=0

Paul 

  • In that case you will have to apply the filter based on the purchase and not according to percentage as it will alwas be less than 50000.

    Something like this:

     

    _Segment GP_SGD = CALCULATE([SALES GP%],
    FILTER(ADDCOLUMNS(VALUES(SALES[Customer Name]),
    "ABCD",CALCULATE(divide(Sum(SALES[sales]),'RATE'[_rate]),CALCULATETABLE(VALUES(SALES[Customer Name])))),
    COUNTROWS(FILTER(Brackets,
    [abcd]>=Brackets[ Lower ]&&[ABCD]<=Brackets[ Upper ]))>0))
     
    See if it gives you the desired result

4 Replies

  • PC2790's avatar
    PC2790
    Icon for Community Champion rankCommunity Champion

    Isn't that because of the nature of the data?

    All the values of Sales GP% is in the bracket of <=50000 and hence the values are appearing to be as expected.

    See this:

     

    • admin11's avatar
      admin11
      Icon for Memorable Member rankMemorable Member

      PC2790 

      Thank you for your sharing. appreciate very much.

      But i have customer who purchase are >50K , i like to know what is the GP% , as you notice that Table 1 and 2 both can display 3 column data.

       

      • PC2790's avatar
        PC2790
        Icon for Community Champion rankCommunity Champion

        In that case you will have to apply the filter based on the purchase and not according to percentage as it will alwas be less than 50000.

        Something like this:

         

        _Segment GP_SGD = CALCULATE([SALES GP%],
        FILTER(ADDCOLUMNS(VALUES(SALES[Customer Name]),
        "ABCD",CALCULATE(divide(Sum(SALES[sales]),'RATE'[_rate]),CALCULATETABLE(VALUES(SALES[Customer Name])))),
        COUNTROWS(FILTER(Brackets,
        [abcd]>=Brackets[ Lower ]&&[ABCD]<=Brackets[ Upper ]))>0))
         
        See if it gives you the desired result