Forum Discussion
DAX expression in creating role
- 3 years ago
Hi navin_Learning,
I have created a simple solution that will take care of your requirement using CALCULATETABLE function, which unfortunately will not work with Direct Query models.
As long as you are going to use the import option (from any source), this method will work fine.
As per sample data provide by you, the unfiltered table will look as below:
As per your condition, user [email protected] can see only one record (ROCD=100, SOCD=20) and that happens.
Another sample for user MNO is also shown below.
You can see the same results for MNT also since his combination is also 101-30.
I hope this is what you have described as your requirement and you can see it happening.
You can download the Excel and PBIX files from this link, if you want:
Please consider accepting this as a SOLUTION so that others can make a note of this and check when needed. Your Kudos are also welcome.
Best Regards,
C.S.N. Raja
- 3 years ago
1. In the source data you can type ALL for either ROCD or SOCD columns or for both the columns as the case may be.
2. Scenario-1: ROCD ALL BUT SOCD IS LIMITED TO 75
3. Scenario-2: ROCD IS LIMITED TO 100 BUT SOCD IS ALL
4. Scenario-3: ROCD = ALL & SOCD = ALL - Now all the records will be displayed
5. Modified DAX code:
6. Please note - both the tables are not connected. The ROCD & SOCD columns are converted into text, since I am using the "ALL" string in them.
Hope this helps.
Regards,
C.S.N. Raja, MCT
Power BI Trainer & Consultant
Thank you so much for your showing interest in my requirement.
Here is the attached sample data in .XLS format, again thank you for your time & attention
Policy data.
| Policy | ROCD | SOCD | Sum |
| 1234 | 100 | 10 | 2000 |
| 5678 | 100 | 10 | 2000 |
| 91011 | 100 | 20 | 3000 |
| 121314 | 101 | 30 | 4000 |
| 151617 | 101 | 30 | 5000 |
| 151618 | 133 | 75 | 600 |
| 151617 | 133 | 75 | 800 |
| 151615 | 144 | 52 | 9000 |
| 151617 | 144 | 52 | 1222 |
User data
| User | ROCD | SOCD |
| [email protected] | 100 | 10 |
| [email protected] | 100 | 10 |
| [email protected] | 100 | 20 |
| [email protected] | 101 | 30 |
| [email protected] | 101 | 30 |
Sorry i could find how to attached the xls file or i guess its restricated from my company
Hi navin_Learning,
I have created a simple solution that will take care of your requirement using CALCULATETABLE function, which unfortunately will not work with Direct Query models.
As long as you are going to use the import option (from any source), this method will work fine.
As per sample data provide by you, the unfiltered table will look as below:
As per your condition, user [email protected] can see only one record (ROCD=100, SOCD=20) and that happens.
Another sample for user MNO is also shown below.
You can see the same results for MNT also since his combination is also 101-30.
I hope this is what you have described as your requirement and you can see it happening.
You can download the Excel and PBIX files from this link, if you want:
Please consider accepting this as a SOLUTION so that others can make a note of this and check when needed. Your Kudos are also welcome.
Best Regards,
C.S.N. Raja