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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Dynamic Calculated Column Based on User Selection on Date Slicer Selection

Hi everyone,

 

I have run into an issue. I have created measures where I am able to get my desire output but now I need to change these measures into calculated columns because I need append these values into another table. Is it possible to append measures to another table? I can't find any answers for it so now I tried to change these measures into calculated columns but the result is not the same / correct.

 

I have an example of the my desired output as well as the measures I created to achieve it, can someone guide me through how to change these measures into dynamic calculated columns that get the same result?

 

From dateTo date
4/1/20195/1/2019

 

LocationDateCount
Seattle4/1/2019200
Seattle4/1/2019200
Seattle4/1/2019150
Seattle4/1/2019100
Seattle4/1/2019115
Seattle4/1/2019110
Seattle5/1/2019300
Seattle5/1/2019

350

 

Desired outcome is 5 calculated columns to derive the from date based on date slicer, to date, the first count of from date, last count of to date, and the avg count. In this example, the result would look like this:

 

LocationFrom DateTo DateFirst Count of From DateLast Count of To DateAvg Count ((First Count from Date + Last Count To Date) / 2)
Seattle4/1/2019 5/1/2019        200         350            275

 

Ultimate goal is to take these calculated columns and append it to another table where I'm taking these counts and merging it with counts of another table. I was able to build this logic using measures but when I try to change them to calculated columns, I don’t get the same results. 

 

Here are the measures I created:

1) This grabs the min date based on date from slicer (from date)

MIN_DATE_SLICER = CALCULATE(MIN('DIMDATE'[DATE]),ALLSELECTED('DIMDATE'[DATE]))
 
2) This grabs the max date based on date from slicer (to date)
MAX_DATE_SLICER = CALCULATE(MAX('DIMDATE'[DATE]),ALLSELECTED('DIMDATE'[DATE]))
 
3) Sum_For_Min_Date = CALCULATE(MAX(CUSTOMER_COUNT[CUSTOMER_COUNT]), FILTER('DIMDATE','DIMDATE'[DATE] = [MIN_DATE_SLICER]))
 
4) Sum_For_Max_Date = CALCULATE(MAX(CUSTOMER_COUNT[CUSTOMER_COUNT]), FILTER('DIMDATE','DIMDATE'[DATE] = [MAX_DATE_SLICER]))
 
5) This grabs the first value from the from date
First_Value_From_Min_Date = CALCULATE([Sum_For_Min_Date],FIRSTNONBLANK('DIMDATE'[DATE], [Sum_For_Min_Date]))
 
6) This grabs the last value from the to date
Last_Value_From_Max_Date = CALCULATE([Sum_For_Min_Date],LASTNONBLANK('DIMDATE'[DATE], [Sum_For_Max_Date]))
 
Finally.... 
7) AVG_Count = ([First_Value_From_Min_Date] + [Last_Value_From_Max_Date])/ 2
 
 
Here is an e.g. of my measures in count cards and a table.... the very bottom table is calculated columns based on the same measure DAX, i am getting circular dependency issues.
 
Screenshot (46)_LI.jpg
5 REPLIES 5
Syndicate_Admin
Administrator
Administrator

Hello!

Do you know if Power BI can generate Pivot Columns?

That is, I have the following case:

ParentsSales% Sales
Mex2530%
Arg3037%
Who56%
Cabbage1518%
Come here79%

But when I filtered, for example, Mexico and Argentina, I got the following result

ParentsSales% Sales
Mex2545%
Arg30

55%

I need this in column, I don't need it as a calculated measure, since that % of sales I need to put in a Slicer

Thanks a lot

What if you use the percentage of column total? That calculates it naturally.

Greg_Deckler
Community Champion
Community Champion

You can base a calculated column on a measure but it won't be dynamic. It will be calculated at the time of data load/refresh and that is it. Calculated columns are not dynamic.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Is it possible to somehow capture the values of the measure and append it onto a table? The main roadblock for me is I need to append the values that the measure is giving me to another table and I don't know if its possible in Power BI. 

Hi @Anonymous ,

 

To capture the value of a measure and attach it to a table,you can try to create the right relationship for two tables.

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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.

Top Solution Authors