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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
govind_021
Super User
Super User

Dax

Hi Dax experts ,
I have one scenerio pleae help me ,
if you see i have parameter and has three categories year , quarter and category 
it is not always the case that thse selection will be in the particular order it can be any order so heirachy is not fixed
what i want is the total of lower heirarchy currently the last one is quarter so , 20,2035 should appear for each row of 2017
and it no fixed category can also be last hierarchy depending upon user selection.
so please help me out with this

govind_021_0-1748333249797.png

please acces demo file here : https://drive.google.com/file/d/1WcxgDWHaG_DcwacmgdSS0z0rd01OKZY3/view?usp=sharing

1 ACCEPTED SOLUTION

Hi @govind_021, 
Thank you for reaching out to the Microsoft fabric community forum. Thank you @ for your input on this issue. 
After thoroughly reviewing the details you provided

Dax Measure: 

Check = 
SWITCH(
    TRUE(),
    ISINSCOPE('Date'[QuarterInCalendar]),
        CALCULATE([Total Sales], REMOVEFILTERS('Date'[QuarterInCalendar])),
    ISINSCOPE('Date'[Year]),
        CALCULATE([Total Sales], REMOVEFILTERS('Date'[Year])),
    ISINSCOPE('Product'[Category]),
        CALCULATE([Total Sales], REMOVEFILTERS('Product'[Category])),
    [Total Sales]
)

Output: 

vsaisraomsft_0-1748347023651.png

 


If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly. 
 
Thank you.

View solution in original post

6 REPLIES 6
v-saisrao-msft
Community Support
Community Support

Hi @govind_021,

 

We haven’t heard back from you regarding your issue. If it has been resolved, please mark the helpful response as the solution and give a ‘Kudos’ to assist others. If you still need support, let us know.

 

Thank you.

v-saisrao-msft
Community Support
Community Support

Hi @govind_021,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

v-saisrao-msft
Community Support
Community Support

Hi @govind_021,
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.

govind_021
Super User
Super User

Hi @pankajnamekar25 
your solution is  not working at all.
i have given the link for file , can you please try from your end and see if it works.

Hi @govind_021, 
Thank you for reaching out to the Microsoft fabric community forum. Thank you @ for your input on this issue. 
After thoroughly reviewing the details you provided

Dax Measure: 

Check = 
SWITCH(
    TRUE(),
    ISINSCOPE('Date'[QuarterInCalendar]),
        CALCULATE([Total Sales], REMOVEFILTERS('Date'[QuarterInCalendar])),
    ISINSCOPE('Date'[Year]),
        CALCULATE([Total Sales], REMOVEFILTERS('Date'[Year])),
    ISINSCOPE('Product'[Category]),
        CALCULATE([Total Sales], REMOVEFILTERS('Product'[Category])),
    [Total Sales]
)

Output: 

vsaisraomsft_0-1748347023651.png

 


If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly. 
 
Thank you.

pankajnamekar25
Super User
Super User

Hello @govind_021 

 

Try this measure

Dynamic Lowest Level Total =

VAR VisibleColumns = SELECTCOLUMNS(VALUES('YourTable'), "Column", "YourColumnName")

VAR IsQuarterVisible = ISINSCOPE('YourTable'[Quarter])

VAR IsYearVisible = ISINSCOPE('YourTable'[Year])

VAR IsCategoryVisible = ISINSCOPE('YourTable'[Category])

 

RETURN

SWITCH(

    TRUE(),

    NOT IsQuarterVisible && NOT IsCategoryVisible,

        CALCULATE([Total Sales], REMOVEFILTERS('YourTable'[Year])),

   

    NOT IsQuarterVisible && NOT IsYearVisible,

        CALCULATE([Total Sales], REMOVEFILTERS('YourTable'[Category])),

   

    NOT IsYearVisible && NOT IsCategoryVisible,

        CALCULATE([Total Sales], REMOVEFILTERS('YourTable'[Quarter])),

 

    NOT IsQuarterVisible,

        CALCULATE([Total Sales], REMOVEFILTERS('YourTable'[Quarter])),

 

    NOT IsYearVisible,

        CALCULATE([Total Sales], REMOVEFILTERS('YourTable'[Year])),

 

    NOT IsCategoryVisible,

        CALCULATE([Total Sales], REMOVEFILTERS('YourTable'[Category])),

 

    -- If all are visible, assume the last is the most granular

    CALCULATE([Total Sales])

)

 

Thanks,
 Pankaj Namekar | LinkedIn

If this solution helps, please accept it and give a kudos (Like), it would be greatly appreciated.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.