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
Jonjon_99
Helper I
Helper I

VAR with multiple return values

hi im new to power BI and would like to learn how to return multiple values based on my matrix column (month, year, quarter, etc.)
i have dax that will return column total but it is only works for month, can anyone help me update this with Year and quarter?

thanks in advance! 

 

%Total Units =
VAR CurrentMonth = MAX('Date'[MonthName])
RETURN
DIVIDE(SUM(SalesFact[Units]),
                        CALCULATE(SUM(SalesFact[Units]),FILTER(ALLSELECTED(SalesFact),RELATED('Date'[MonthName])=CurrentMonth)))
9 REPLIES 9
AlanP514
Post Patron
Post Patron

Hai @Jonjon_99 
Can you please elaborate your question and what you are trying to achive and the expected output you are looking, if its possible please share pbix file using dummy data

Hi @Jonjon_99 
Thank for sharing , recieved the data, now please explain your expected output in detailed way ,
What you are trying to achive , i am not geeting by reading your previous

Hi Alan, thanks again for your reply.
i have sales type filter, for my units,sales and total percenatage of units and sales by column.
right now, it is working in my first matrix if i want to calculate the pecnetage of column by monthly summary cause i have this DAX which is specific only for monthly summary.

%Total Units =
VAR CurrentMonth = MAX('Date'[MonthName])
RETURN
DIVIDE(SUM(SalesFact[Units]),
                        CALCULATE(SUM(SalesFact[Units]),FILTER(ALLSELECTED(SalesFact),RELATED('Date'[MonthName])=CurrentMonth)))
 

Jonjon_99_1-1692253857013.png

now, i want also this filter to work with my yearly matrix. as you can see, calculation is incorrect because the total is >100%.

Jonjon_99_2-1692254148389.png

hope it is clearer now. sorry that my english is not good. haha! apreciate your time and help!


https://drive.google.com/drive/folders/1i7N8YWWwMvZHEU08rxWIRDBsaC_kz6sg?usp=sharing

 



AlanP514_1-1692257488626.png


Hi @Jonjon_99 ,
Here i am attaching the pbix file and screenshot , please confirm this is what you are looking for 
if this is the solution, appreciate to support and accept as a solution

 

Hi Alan,

thanks for checking. still not correct.

this is the result i am expecting.

Jonjon_99_0-1692257975807.png

 

Hi @Jonjon_99 

AlanP514_0-1692257189167.png


Can you please Check these tables 
Above you can see %total units with months
Down you can see %total units with year and it is not showing above >100 %, please confirm 

 

hi Alan, thanks for checking. i want to have a table calculated by year.

Jonjon_99_0-1692249243158.png

it works in monthly but not in yearly

result should be 100% aswell in yearly summary.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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