Forum Discussion
Creating a measure to dynamically update as you select
Hi all, noob here but trying to get the hang of things.
I am trying to create a measure that when I select an item (or in this example, a name) to view metrics on, it will calculate what "level" the name I am looking at is and return calculations specific to that level.
Using the example below:
There are different "levels" for our website that have event 1 available. I have a measure that tells me sitewide metrics about event A, and a measure that will tell me the event specific detail when I select a name, like Yellow Big Hammers.
I want to be able to select "Yellow Big Hammers" and then have a third measure autopopulates the event 1 metrics across all of the Level 3 data.
That way, if I wanted to select Big Hammers, it would automatically update and show me the L2 data associated with Event 1.
Does this make sense? I can't figure out how to create variables, or have a measure identify a filter on the page to use that as basis to build the data on.
Any help here would be great. Thanks!
TableA includes the following columns.
Name
Level
Event 1
Name | Level | Event
Hammers L1 1
Nails L1 2
Lights L1 2
Big Hammers L2 1
Big Nails L2 2
Big Lights L2 1
Yellow Big Hammers L3 2
Green Big Nails L3 3
Yellow Big Lights L3 2
3 Replies
- mike9999
Advocate I
What you are looking for should be do-able in PowerBI.
By default, the different tables/slicers/charts are cross-filter the data. So in your example, when you select "Yellow Big Hammer" then the measures will recalculate/any charts with cross-filter.
So to do what you need, step 1- make a slicer with the "Name" column of your table.
Step 2- create a relationship between the Level and the table that contains your website view metrics (it needs to have a Level column)
Step 3- create whatever measures are required to interpret the data. you didn't specify what type of aggregations/metrics you are looking for from the website view metrics. it's also possible to aggregate without measures, and chart the website view metrics table directly.
hope that at least helps you get started.
- PowerBI_N00bRegular Visitor
Thanks for your help. I think I am half way there. I have the following measure that correctly aggregrates what I am looking for across all levels. How would I modify this to specifically call out the level specific aggegration? I have a few different meaures calculating stuff, this was all just illustrative:
This is the entire event 1 comparison (i modified the original code to fit the description)
Overall Level Event 1 calculation = CALCULATE([Event 1 calculation], ALL('Table A'))Using the following for the level(x) calculation, what would I create?Levelx Level Event 1 calculation = CALCULATE([Event 1 calculation], ALL('Table A')) - PowerBI_N00bRegular Visitor
I tried the following variation of the formula and got this error: "Cannot convert value 'L1' of type text to type true/false". Any ideas on how to resolve?
Levelx Level Event 1 calculation = CALCULATE([Event 1 calculation], TableA[LEVEL])