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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
bbass82
Helper I
Helper I

Can't get share percentage by different field parameters to work for creating a measure

Hello All,

 

Looking for some DAX help in creating a measure for share % of total sales year to date based on fields I have in a parameter table and am using as a slicer in my visual. 

 

First measure I created was to calculate my total POS $ YTD for current week and year based on our business week planning calendar. 

POS YTD $ (NEW) =
VAR _CurrentWeek = WEEKNUM(TODAY(),21)  -- ISO week number (Monday-Sunday)

RETURN
CALCULATE(
    [TOTAL POS $],
    'POS Planning Table'[PlanningWeek] < _CurrentWeek,  -- Include only weeks up to the current week - 1
    'POS Planning Table'[PlanningYear] = MAX('POS Planning Table'[PlanningYear]) -- Ensure filtering by Year
)
 
Then I created a field parameter table based and a slicer based on what fields I wanted have users click on so the table switches by these main fields. 
 
FieldSwitchParameter = {
    ("GBT", NAMEOF('POS History Analysis'[GBT]), 0),
    ("Product Class", NAMEOF('POS History Analysis'[Product Class Description]), 1),
    ("Product Family", NAMEOF('POS History Analysis'[Product Family Num + Product Desc]), 2),
    ("Material | SKU", NAMEOF('POS History Analysis'[Material Num + Material Desc]), 3)
}
 
Below is the output I am getting for categories under each field parameter - POS $ YTD numbers are coming out correct but share percentage of total YTD sales is not. I have looked this up for hours and can't figure out where I might be going wrong. Any help is greatly appreciated.
 
bbass82_0-1742228966726.png

 

Example of how my field parameter slicer is setup:

bbass82_1-1742229024563.png

 

Kind Regards,

Brandon B

 

 
1 ACCEPTED SOLUTION
Deku
Super User
Super User

% =

Divide(

[POS $ YTD],

Calculate(

[POS $ YTD],

Allselected()

)

)


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

2 REPLIES 2
Deku
Super User
Super User

% =

Divide(

[POS $ YTD],

Calculate(

[POS $ YTD],

Allselected()

)

)


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

Deku!!!! Thank-you so much for your help on this. Worked perfectly for what I needed to show in the visual and works perfect based on my parameter slicer switch. Can't thank-you enough. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.