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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
AlexaderMilland
Helper III
Helper III

Field Parameters and Calculation Groups together?

Im working in power bi.

I have a fact.orders table with OrderID | ShipmentDate | PaymentDate | IsNewPayment | IsNewShipment

 

I also have a calendar table with inactive relationships to ShipmentDate and PaymentDate.

I have a calculation group to swap between using the shipment or payment date.

 

I now need to build some logic so that when the calculationgrouphas picked PaymentDate, the categorical field used in a visual for IsNew is also using Payment date. 

Basically i want to "category" of IsNew to swap from IsNew Payment to IsNew Shipment when the calculation group is swapped on the relationship for calculation date type. 
I've tried with field parameters, but couldn't find a way to get it to work, even when added logic like FILTER and ALL to the calculation group. 
Any suggestions?

Link to sample dataset: https://drive.google.com/file/d/1l3NBi8fhiWAFxExF0D_nqyrFD6AfBFUa/view?usp=drive_link

 

 

 

 

https://drive.google.com/file/d/1l3NBi8fhiWAFxExF0D_nqyrFD6AfBFUa/view?usp=drive_link

8 REPLIES 8
AlexaderMilland
Helper III
Helper III

Guess it wasn't super clear since you couldn't open the model. 
IsNew Payment/Shipment are categorical fields, they contain text values such as (New, Returning, Reactivated). 
I want to use it as a cateogrical field inside say a matrix visual on a row low. So it cannot be a measure, it has to be a dimension. That's why i was trying with field parameters

@v-yohua-msft in case you didn't see my reply as it looks like it wasn't linked to you 🙂 

Hi, @AlexaderMilland 

Sorry to restore you so late. After my attempts, it seems that using the calculation group cannot achieve the results you want, and it is also possible that my knowledge is too shallow. I've tried using a calculated column to determine the selected slicer contents, but the calculated column can't read the slicer value, and I can't put it in the Row of the matrix using a measure.
If you want to use parameters, you just need to create a parameter, check PaymentDate and ShipmentDate.

vyohuamsft_0-1728019152167.png

vyohuamsft_1-1728019169577.png

 

Then put the created parameter column in the Row of the matrix view.

vyohuamsft_3-1728019204512.png

When select slicer, the martix will change:

vyohuamsft_4-1728019241892.png

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

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

Ideally what im looking at is a solution that with just 1 click

 

1) enables the calculation group to swap the relationship between the calendar table and the fact table

2) swaps the caterogical field inside the visual from IsNew Payment to IsNew Shipment, probably through the use of a field parameter. 

Could you post the PBIX file since it looks like you left out some steps. 
The photo with the field parameters is based on the date field, while the slicer in last photo is based on the IsNew category? 

v-yohua-msft
Community Support
Community Support

Hi, @AlexaderMilland 

I'm sorry I can't open your sample file link, I created the sample data:

Orders Table

vyohuamsft_0-1727838557371.png

Calendar Table

vyohuamsft_1-1727838571046.png

Relationship

vyohuamsft_2-1727838625463.png

 

Create calculated group:

vyohuamsft_3-1727838686859.png

 

Then put this group in Slicer view and create a new measure, try the following DAX:

 

 

IsNewDynamic = 
SWITCH(
    SELECTEDVALUE('Calculation group'[Calculation group column]),
    "ShipmentDate", CALCULATE(SUM('Orders'[IsNewShipment]), USERELATIONSHIP('Calendar'[Date], 'Orders'[ShipmentDate])),
    "PaymentDate", CALCULATE(SUM('Orders'[IsNewPayment]), USERELATIONSHIP('Calendar'[Date], 'Orders'[PaymentDate]))
)

 

 

 

Put this measure in visual. When you click on the slicer, the date is switched, here is my preview:

vyohuamsft_4-1727838903197.png

vyohuamsft_5-1727838963027.png

 

How to Get Your Question Answered Quickly

Best Regards

Yongkang Hua

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

@v-yohua-msft  This is what Exactly i was trying to suggest! Welldone!




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


The above solution does not work? 

Helpful resources

Announcements
September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Top Solution Authors