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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
bbass82
Frequent Visitor

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
Community Champion
Community Champion

% =

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
Community Champion
Community Champion

% =

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!
bbass82
Frequent Visitor

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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