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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

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
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors