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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anindita198
New Member

Dax query to create a measure that returns values from another columns based on slicer selection

I want to create a measure which will return sum of unique visits and unique visitors based on pagename selected in slicer .

 

Note - pagename, visits and visitors column are all part of same table .

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anindita198 

According to your needs , I create a sample to return the value you want .

Original data :

Ailsamsft_0-1668476959860.png

Then add a slicer with pagename .

Ailsamsft_1-1668476987877.png

Then create a measure to count sum of unique visits and unique visitors .

Measure = 
VAR _VISITORS=DISTINCTCOUNT('Table'[visitors])
VAR _VISITS=DISTINCTCOUNT('Table'[visits])
RETURN _VISITS+_VISITORS

When you choose pagename =page 1,you will get a result like this (unique visitors is 4 and unique visits is 4 , so the sum is 8):

Ailsamsft_2-1668477083132.png

I have attached my pbix file , you can refer to it .

 

Best Regards,
Community Support Team _ Ailsa Tao
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

1 REPLY 1
Anonymous
Not applicable

Hi @Anindita198 

According to your needs , I create a sample to return the value you want .

Original data :

Ailsamsft_0-1668476959860.png

Then add a slicer with pagename .

Ailsamsft_1-1668476987877.png

Then create a measure to count sum of unique visits and unique visitors .

Measure = 
VAR _VISITORS=DISTINCTCOUNT('Table'[visitors])
VAR _VISITS=DISTINCTCOUNT('Table'[visits])
RETURN _VISITS+_VISITORS

When you choose pagename =page 1,you will get a result like this (unique visitors is 4 and unique visits is 4 , so the sum is 8):

Ailsamsft_2-1668477083132.png

I have attached my pbix file , you can refer to it .

 

Best Regards,
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.