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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors