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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Pinky0404
Helper III
Helper III

DAX Fun

Hi,

 

I have a requirement to create a trend(in %) for the repeat offenders who clicked in campaigns.

 

Eg: A, B, C are three campaigns and are three different tables.There is a column called "Clicked" which has value Yes/No.

 

My requirement is to show the trend line where

1)the first bar in the trend graph should represent the user clicks from Campaign A. and the value of A should be running total

2)Second bar in the trend graph should represent the user common clicks from A & B and

3) third bar should give thecommon  clicks of A&B &C.

so on..

 

Note: the percentage of each bar should be individual not the % of grand total. 

Say, 2nd bar must be calculated as clicks from A & B divided by total clicks from A.. 

 

I tried merging the tables, but loosing the data, Please Help!!

 

 

1 ACCEPTED SOLUTION


@Pinky0404 wrote:

Hi,

 

Here is the sample data set .

Sample Data.PNG

 

 

 


@Pinky0404

You need to union those 3 tables

Surveys = UNION(Survey1,Survey2,Survey3)

Then create measures as 

perc A & B & C = 
VAR summizedTbl =
    SUMMARIZE (
        FILTER ( Surveys, Surveys[Primary Clicked] = TRUE ),
        Surveys[Email address],
        "CNT", DISTINCTCOUNT ( Surveys[Survey Title] )
    )
RETURN
    DIVIDE (
        COUNTROWS ( FILTER ( summizedTbl, [CNT] = 3 ) ),
        DISTINCTCOUNT ( Surveys[Email address] )
    )



perc A & B = 
VAR summizedTbl =
    SUMMARIZE (
        FILTER ( Surveys, Surveys[Primary Clicked] = TRUE &&(Surveys[Survey Title]="Survey upgrade"||Surveys[Survey Title]="Survey Apple") ),
        Surveys[Email address],
        "CNT", DISTINCTCOUNT ( Surveys[Survey Title] )
    )
RETURN
    DIVIDE (
        COUNTROWS ( FILTER ( summizedTbl, [CNT] = 2 ) ),
        DISTINCTCOUNT ( Surveys[Email address] )
    )



perc A = 
    DIVIDE (
        COUNTROWS ( FILTER ( Surveys, Surveys[Primary Clicked] = TRUE &&(Surveys[Survey Title]="Survey upgrade" ) )),
        DISTINCTCOUNT ( Surveys[Email address] )
    )

Capture.PNG

 

See more details in the attached pbix file.

 

View solution in original post

4 REPLIES 4
Eric_Zhang
Microsoft Employee
Microsoft Employee


@Pinky0404 wrote:

Hi,

 

I have a requirement to create a trend(in %) for the repeat offenders who clicked in campaigns.

 

Eg: A, B, C are three campaigns and are three different tables.There is a column called "Clicked" which has value Yes/No.

 

My requirement is to show the trend line where

1)the first bar in the trend graph should represent the user clicks from Campaign A. and the value of A should be running total

2)Second bar in the trend graph should represent the user common clicks from A & B and

3) third bar should give thecommon  clicks of A&B &C.

so on..

 

Note: the percentage of each bar should be individual not the % of grand total. 

Say, 2nd bar must be calculated as clicks from A & B divided by total clicks from A.. 

 

I tried merging the tables, but loosing the data, Please Help!!

 

 


@Pinky0404

You may have to create extra auxiliary tables. Could you post sample data of those 3 tables and expected output?

Hi,

 

Here is the sample data set .

Sample Data.PNG

 

 

 


@Pinky0404 wrote:

Hi,

 

Here is the sample data set .

Sample Data.PNG

 

 

 


@Pinky0404

You need to union those 3 tables

Surveys = UNION(Survey1,Survey2,Survey3)

Then create measures as 

perc A & B & C = 
VAR summizedTbl =
    SUMMARIZE (
        FILTER ( Surveys, Surveys[Primary Clicked] = TRUE ),
        Surveys[Email address],
        "CNT", DISTINCTCOUNT ( Surveys[Survey Title] )
    )
RETURN
    DIVIDE (
        COUNTROWS ( FILTER ( summizedTbl, [CNT] = 3 ) ),
        DISTINCTCOUNT ( Surveys[Email address] )
    )



perc A & B = 
VAR summizedTbl =
    SUMMARIZE (
        FILTER ( Surveys, Surveys[Primary Clicked] = TRUE &&(Surveys[Survey Title]="Survey upgrade"||Surveys[Survey Title]="Survey Apple") ),
        Surveys[Email address],
        "CNT", DISTINCTCOUNT ( Surveys[Survey Title] )
    )
RETURN
    DIVIDE (
        COUNTROWS ( FILTER ( summizedTbl, [CNT] = 2 ) ),
        DISTINCTCOUNT ( Surveys[Email address] )
    )



perc A = 
    DIVIDE (
        COUNTROWS ( FILTER ( Surveys, Surveys[Primary Clicked] = TRUE &&(Surveys[Survey Title]="Survey upgrade" ) )),
        DISTINCTCOUNT ( Surveys[Email address] )
    )

Capture.PNG

 

See more details in the attached pbix file.

 

Thanks alot.  Appreciate your help.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors