Forum Discussion
shubh_kush
Helper I
5 years agoGeneric Column based on other columns in Powerbi
Hi Everyone, I have one query in my Powerbi report. Below are the three different benefits (Benefit 1, Benefit 2 & Benefit 3) with another column Deployment Model in a table visual. (Ref: Table ...
- 5 years ago
Hi shubh_kush ,
You can create a seperate table for unique benefits as below
Table 2 = VAR distnct_benefit1 = DISTINCT ( Deployment[Benefit 1] ) VAR distnct_benefit2 = DISTINCT ( Deployment[Benefit 2] ) VAR distnct_benefit3 = DISTINCT ( Deployment[Benefit 3] ) RETURN DISTINCT ( UNION ( distnct_benefit1, distnct_benefit2, distnct_benefit3 ) )Now create a two measure one for onprem and another for cloud with below code
Cloud = VAR result = CALCULATE ( COUNT ( Deployment[Deployement] ), FILTER ( Deployment, Deployment[Deployement] = "Cloud" && ( Deployment[Benefit 1] = MAX ( 'Table 2'[Benefits] ) || Deployment[Benefit 2] = MAX ( 'Table 2'[Benefits] ) || Deployment[Benefit 3] = MAX ( 'Table 2'[Benefits] ) ) ) ) RETURN IF ( ISBLANK ( result ), 0, result )On_Prem = VAR result = CALCULATE ( COUNT ( Deployment[Deployement] ), FILTER ( Deployment, Deployment[Deployement] = "On Prem" && ( Deployment[Benefit 1] = MAX ( 'Table 2'[Benefits] ) || Deployment[Benefit 2] = MAX ( 'Table 2'[Benefits] ) || Deployment[Benefit 3] = MAX ( 'Table 2'[Benefits] ) ) ) ) RETURN IF ( ISBLANK ( result ), 0, result )Now add benefits column from newly created table and add above measure you will see required output as below
Thanks,
Samarth
amitchandak
Super User
5 years agoshubh_kush , have you tried unpivot if possible
shubh_kush
Helper I
5 years agoI tried Unpivoting it but it will change the structure of the table and data. I'm looking for a solution by which I can create one single column with all the Benefits value, so that I can show count based on each Deployment type. The issue I'm facing with the 3 different benefits columns as I cannot create 3 differnet relationship between two tables.