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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Chanleakna123
Post Prodigy
Post Prodigy

Turn Condition measure into Column In order to do Some slicer

Hi All , 

i have successfully done the condition measure as per below . and i would like to turn this into column , the intention to do so is , that would be easier to do some filter on each rank as apply . in the meantime , i couldn't perform any filter or slicer because it's measure . may i know how can we acheive this ? 

 

test =
SWITCH (
    TRUE (),
    [%Growth 330-Sell both]  > -0.1, ">00%",
     [%Growth 330-Sell both]  > -0.2, ">10%",
     [%Growth 330-Sell both] > -0.5, ">30%",
      [%Growth 330-Sell both]  > -0.7, "50%",
    [%Growth 330-Sell both] > -1, ">70%",    
    ">100%"
)

 

Screenshot 2022-11-01 212411.png

1 ACCEPTED SOLUTION

Hi , @Chanleakna123 

Here are the steps you can refer to :

(1)My test data is teh same as yours.

(2)We can click "New Column "to create a calculated column :

Deciling Bank = var _current_customer = 'Table'[Customer Code]
var _cunrrent_year = YEAR('Table'[Date])
var _last_year =SUMX( FILTER('Table','Table'[Customer Code]=_current_customer && YEAR('Table'[Date]) =_cunrrent_year -1 ) ,[Vol])
var _this_year =SUMX( FILTER('Table','Table'[Customer Code]=_current_customer && YEAR('Table'[Date]) =_cunrrent_year  ) ,[Vol])
var _Growth = DIVIDE( _this_year - _last_year , _last_year)
return
IF(_Growth <0  , SWITCH(TRUE() , _Growth>=-0.1 && _Growth<=0 ,"0%-10%" , _Growth>=-0.3 && _Growth<-0.1 ,"10%-30%",_Growth>=-0.5 && _Growth<-0.3,"30%-50%",_Growth>=-0.7 && _Growth<-0.5 ,"50%-70%",_Growth>=-0.9 && _Growth<-0.7,"70%-90%" , _Growth>=-1 && _Growth<-0.9 ,"90%-100%+" )            , BLANK())

(2)Then we can meet your need , the result is as follows:

vyueyunzhmsft_0-1667465825086.png

(3)The second need I have realized in the "Report" view , you can see it in the .pbix file .

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

 

Best Regards,

Aniya Zhang

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

8 REPLIES 8
v-yueyunzh-msft
Community Support
Community Support

Hi , @Chanleakna123 

Here are the steps you can refer to :

(1)This is my test data :

vyueyunzhmsft_0-1667356356426.png

(2)We need to create a table like this:

vyueyunzhmsft_1-1667356379124.png

(3)Then we can create a measure :

Measure = var _slicer_table = VALUES('Slicer Table'[Compare])
var _min_slicer = MINX(_slicer_table,[Compare])
var _value =SELECTEDVALUE('Table'[%Growth 330-Sell both])
return
IF( _value > _min_slicer ,1,0)

(4)Then we can put the measure on the "filter on this visual" then we can meet your need:

vyueyunzhmsft_2-1667356426663.png

 

Best Regards,

Aniya Zhang

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

Hi @v-yueyunzh-msft  , the Growth 330-sell both is a measure as i am having right now. 

and when i use the formula seems not working on the measure of Growth 330-sell both. 

can you please help on this ? 

 

this is my mesure of growth rate : 

%Growth-Selling Both = IFERROR(([Vol.PC330+185ml-Both Selling]-[LY-Store selling both])/[LY-Store selling both],0)

 

my purpose is to put into the visual , to see which customer is piloting into any rank . 

Measure = var _slicer_table = VALUES('Slicer Table'[Compare])
var _min_slicer = MINX(_slicer_table,[Compare])
var _value =SELECTEDVALUE('Table'[%Growth 330-Sell both])
return
IF( _value > _min_slicer ,1,0)

 

Hi , @Chanleakna123 

If it is a measure , you just need to modify the "_value" parameter in the dax :

Measure = var _slicer_table = VALUES('Slicer Table'[Compare])
var _min_slicer = MINX(_slicer_table,[Compare])
var _value =[Your Measure]
return
IF( _value > _min_slicer ,1,0)

Then we can realize it.

vyueyunzhmsft_0-1667367430200.png

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

 

Best Regards,

Aniya Zhang

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

hi @v-yueyunzh-msft , 

 

this is what we want . Rank column , is what we want , so when we do the visualization , we will put this into legend part to understand how many customer falls into each rank. 

 

Screenshot 2022-11-02 141245.png

 

Hi , @Chanleakna123 

Sorry , i didn't meet your need . According to yuour description, you want to create a calculated column to get the "Rank" column . Right?

And the judgement is the measure of [%Growth-Selling Both]. 

For your needs, when we create a new column, we need to write dax according to your needs, find the corresponding [%Growth-Selling Both] value for each row, and then use the switch() function to judge and output the corresponding value.

For each row to calculate the corresponding [%Growth-Selling Both] is to combine your business logic to write DAX, if you can, you can provide the following sample data template, and the final sample data you want to give us, so that we can better help you.

 

Best Regards,

Aniya Zhang

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

hi @v-yueyunzh-msft , 

 

let me share the raw data we have and the output we expect there. 

 

 

Screenshot 2022-11-03 142650.png

Hi , @Chanleakna123 

Here are the steps you can refer to :

(1)My test data is teh same as yours.

(2)We can click "New Column "to create a calculated column :

Deciling Bank = var _current_customer = 'Table'[Customer Code]
var _cunrrent_year = YEAR('Table'[Date])
var _last_year =SUMX( FILTER('Table','Table'[Customer Code]=_current_customer && YEAR('Table'[Date]) =_cunrrent_year -1 ) ,[Vol])
var _this_year =SUMX( FILTER('Table','Table'[Customer Code]=_current_customer && YEAR('Table'[Date]) =_cunrrent_year  ) ,[Vol])
var _Growth = DIVIDE( _this_year - _last_year , _last_year)
return
IF(_Growth <0  , SWITCH(TRUE() , _Growth>=-0.1 && _Growth<=0 ,"0%-10%" , _Growth>=-0.3 && _Growth<-0.1 ,"10%-30%",_Growth>=-0.5 && _Growth<-0.3,"30%-50%",_Growth>=-0.7 && _Growth<-0.5 ,"50%-70%",_Growth>=-0.9 && _Growth<-0.7,"70%-90%" , _Growth>=-1 && _Growth<-0.9 ,"90%-100%+" )            , BLANK())

(2)Then we can meet your need , the result is as follows:

vyueyunzhmsft_0-1667465825086.png

(3)The second need I have realized in the "Report" view , you can see it in the .pbix file .

 

If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.

 

Best Regards,

Aniya Zhang

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

 

hi dear,

i have applied as said , and when i click on declining rank from 30%->50% , it gives me the customers who also flat 0% also in the rank  as well as the customers who are declining -100% also within the rank  . however i can see the right customers who are in the list of declining rate of 30%->50%  . can we fix on 0% and -100% ? 
i tryna play around , but it's not working as expected. 

 

Screenshot 2022-11-11 154806.png

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.