Forum Discussion
Creating a Dimension that is dependent on Parameter Selected
Hi, EACruz ,
Here's how to achieve dynamic aging groups in Power BI using DAX:
-
Create a Parameter Table (Disconnected Table) : AgingParameter = DATATABLE("Aging Selection", STRING, { "DOS Aging", "Denial Aging" })
- Capture Selected Parameter:
SelectedAging = SELECTEDVALUE(AgingParameter[Aging Selection], "DOS Aging") - Define Aging Days Based on Selection:
AgingDays = SWITCH([SelectedAging], "DOS Aging", SELECTEDVALUE('YourTable'[DOS Aging]), "Denial Aging", SELECTEDVALUE('YourTable'[Denial Aging])) - Create Aging Group Logic: AgingGroup:
AgingGroup = SWITCH(TRUE(), [AgingDays] IN {"000 - 030", "031 - 060", "061 - 090"}, "000 - 090","091 +") -
Use in Matrix Visual
- Place AgingGroup in Rows.
- Use measure values in Values.
- Add AgingParameter[Aging Selection] as a slicer.
- EACruz1 year agoFrequent Visitor
Hi rohit1991 ,
I appreciate the detailed explanation! I was able to reacreate all of the Fields as you mentioned above.
The only challenge with 'Aging Days' is that if we use the SELECTEDVALUE function then we are expecting to see One Distinct Value but as shown below 'DOS Aging' and 'Denial Aging' has a list of Values. I wanted to use it as a Dimension to toggle between one and the other without the addition of another Parameter. In other words, 'Aging Selection' should allow me to switch between 'DOS Aging' and 'Denial Aging' Dimensions.