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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Avivek
Post Partisan
Post Partisan

Need help with the dax

I have a dax which is 

Total Procedures(TagLocation) =
SUMX (
    VALUES ( 'Tag Usage Fact'[Tag ID] ),
    CALCULATE (
        SUM ( 'Procedure Fact'[Procedures] ),
        --ALLEXCEPT ( 'Account Dim', 'Account Dim'[Account ID] ),
        ALLEXCEPT (
            'Tag Usage Fact',
            'Tag Usage Fact'[Tag ID]
        ),
        FILTERS ( 'Tag Usage Fact'[Order Date] ), FILTERS('Tag Usage Fact'[Tag Owner Name])
    )
)
 
This gives the desired results as well. But with this I am facing 2 problems, 
1. If i select the usage type as used/shared, total procedure should not be changing but it changes .
   Avivek_0-1660027404106.png

If I don't select Used/Shared then the column in total procedure is how it comes but if I select Used total procedure just show 1 line as total procedure changes to 3(it should have been still 23) and if I select Borrowed then total procedure changes to 20(it should have been still 23). I tried to change the dax to 

Test.Total Procedures(TagLocation) =
SUMX (
    VALUES ( 'Tag Usage Fact'[Tag ID] ),
    CALCULATE (
        SUM ( 'Procedure Fact'[Procedures] ),
        ALLEXCEPT (
            'Tag Usage Fact',
            'Tag Usage Fact'[Tag ID],'Tag Usage Fact'[Usage Type]
        ),
        FILTERS ( 'Tag Usage Fact'[Order Date] ), FILTERS('Tag Usage Fact'[Tag Owner Name])))
But then that gives me result as in last column Test.Total Procedure(TagLocation).
 
2. We have given % of Usage as is not 100%. 
Avivek_2-1660028147836.png

 

SO in this case ist tag id ie., 0001053 shows a total procedure as and % of usage as 50% but if I select that tag in the slicer then it shows blank

Avivek_4-1660028377039.png

 

This is because when selecting that tag on slicer it considers it as 1 single record and % of usage changes to 100% and total procedure changes to $ instead of 8 because it is taking only the borrowd procedure when the tag is selected.

% of Usage measure is 

% of Usage(tagLocation) = [No of Procedures]/[Total Procedures(TagLocation)]
 
Is there a way to resolve these 2 issues and what should be changed in both the dax.
1 ACCEPTED SOLUTION
RicoZhou2
Resolver I
Resolver I

Hi @Avivek ,

 

According to your statement, I think your problem is that you want to remove the filter from slicer in your visual. As far as I know, if the column in slicer is from same table or from a related table, Power BI will filter your visual by context. Here I suggest you to create unrelated dim tables to build slicer. And you can use SELECTEDVALUE() to catch single value or use VALUES() to catch multiple values in your measure.

If this reply still couldn't help you solve your problem, please share a sample file without sensitive data with us. And show us a screenshot with the result you want. This will make it easier for me to find the solution.

 

Best Regards.

View solution in original post

2 REPLIES 2
Avivek
Post Partisan
Post Partisan

Hi @RicoZhou2 , thankyou this works

RicoZhou2
Resolver I
Resolver I

Hi @Avivek ,

 

According to your statement, I think your problem is that you want to remove the filter from slicer in your visual. As far as I know, if the column in slicer is from same table or from a related table, Power BI will filter your visual by context. Here I suggest you to create unrelated dim tables to build slicer. And you can use SELECTEDVALUE() to catch single value or use VALUES() to catch multiple values in your measure.

If this reply still couldn't help you solve your problem, please share a sample file without sensitive data with us. And show us a screenshot with the result you want. This will make it easier for me to find the solution.

 

Best Regards.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.