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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
ysapiyev
Responsive Resident
Responsive Resident

How data reduction algorithm works?

hi everyone,

 

I have a problem with data reduction algorithm. As I understood from the tutorials, data algorithm works to limit data selection. 

Here is my code in capabilities

"values": {
				"group": {
                "by": "date",
                    "select": [		
						
						{
                            "bind": {
                                "to": "value1"
                            }
                        },
						{
                            "bind": {
                                "to": "value1_unit"
                            }
                        },
                        {
                            "bind": {
                                "to": "value2"
                            }
                        },{
                            "bind": {
                                "to": "value2_unit"
                            }
                        },
                        {
                            "bind": {
                                "to": "value3"
                            }
                        },{
                            "bind": {
                                "to": "value3_unit"
                            }
                        },
                        {
                            "bind": {
                                "to": "value4"
                            }
                        },{
                            "bind": {
                                "to": "value4_unit"
                            }
                        }

                    ]
					,
					"dataReductionAlgorithm": {
						"bottom": {
						 "count": 1
					 }
					}
					}
                }

By logic, it should group my values by date and select latest, since I'm choosing bottom 1. However, I get all of the data. Where is the problem? Or is there more detailed manual for algorithm.

1 ACCEPTED SOLUTION
ysapiyev
Responsive Resident
Responsive Resident

@v-viig,

 

I changed my data links, and now it is working. Thanks

View solution in original post

7 REPLIES 7
v-viig
Community Champion
Community Champion

You have to specify dataReduction for categories as well to limit amount of data rows.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

ysapiyev
Responsive Resident
Responsive Resident

@v-viig,

 

I used same data reduction function for categories, with bottom and count equal to 1. However, I still get full amount of data.

v-viig
Community Champion
Community Champion

Please share the whole capabilities.json

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

 

 

ysapiyev
Responsive Resident
Responsive Resident

@v-viig

 

{
    "dataRoles": [
        {
            "displayName": "Item name",
            "name": "category",
            "kind": "Grouping"
        },
        {
            "displayName": "Dates",
            "name": "date",
            "kind": "Grouping"
        },
        {
            "displayName": "value1",
            "name": "value1",
            "kind": "Measure"
        },
		{
            "displayName": "value1 unit",
            "name": "value1_unit",
            "kind": "Measure"
        },

        {
            "displayName": "value2",
            "name": "value2",
            "kind": "Measure"
        },
		{
            "displayName": "value2 unit",
            "name": "value2_unit",
            "kind": "Measure"
        },
		{
            "displayName": "value3",
            "name": "value3",
            "kind": "Measure"
        },
		{
            "displayName": "value3 unit",
            "name": "value3_unit",
            "kind": "Measure"
        },
        {
            "displayName": "value4",
            "name": "value4",
            "kind": "Measure"
        },
        {
            "displayName": "value4 unit",
            "name": "value4_unit",
            "kind": "Measure"
        }
    ],
    "objects": {
		"myCustomObj": {
		"displayName": "Chart settings",
      "properties": {
                
				"threshold_color_1": {
                    "displayName": "threshold_color_1",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                }
				,
				"threshold_color_2": {
                    "displayName": "threshold_color_2",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                },"threshold_color_3": {
                    "displayName": "threshold_color_3",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                },
				"threshold_color_4": {
                    "displayName": "threshold_color_4",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                },
				"fontSize": {
                    "displayName": "Text Size",
                    "type": {
                        "formatting": {
                            "fontSize": true
                        }
                    }
                },
				"fontSize_sec": {
                    "displayName": "Text Size for sec",
                    "type": {
                        "formatting": {
                            "fontSize": true
                        }
                    }
                },
				"fontFamily": {
                    "displayName": "Font family",
                    "type": {
                        "enumeration": [
                            {"value": "Arial", "displayName": "Arial"},
							{"value": "Arial Black", "displayName": "Arial Black"},
							{"value": "Arial Unicode MS", "displayName": "Arial Unicode MS"},
							{"value": "Bookman Old Style", "displayName": "Bookman Old Style"},
							{"value": "Calibri", "displayName": "Calibri"},
							{"value": "Cambria", "displayName": "Cambria"},
							{"value": "Candara", "displayName": "Candara"},
							{"value": "Castellar", "displayName": "Castellar"},
							{"value": "Comic Sans MS", "displayName": "Comic Sans MS"},
							{"value": "Consolas", "displayName": "Consolas"},
							{"value": "Constantia", "displayName": "Constantia"},
							{"value": "Corbel", "displayName": "Corbel"},
							{"value": "Courier New", "displayName": "Courier New"},
							{"value": "Georgia", "displayName": "Georgia"},
							{"value": "Impact", "displayName": "Impact"},
							{"value": "Lucida Calligraphy", "displayName": "Lucida Calligraphy"},
							{"value": "Lucida Sans Unicode", "displayName": "Lucida Sans Unicode"},
							{"value": "Segoe UI", "displayName": "Segoe UI"},
							{"value": "Segoe UI Light", "displayName": "Segoe UI Light"},
							{"value": "Symbol", "displayName": "Symbol"},
							{"value": "Tahoma", "displayName": "Tahoma"},
							{"value": "Times New Roman", "displayName": "Times New Roman"},
							{"value": "Trebuchet MS", "displayName": "Trebuchet MS"},
							{"value": "Verdana", "displayName": "Verdana"}
                        ]
                    }
                },
				"text_color": {
                    "displayName": "text color",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                },
				"threshold_1": {
                    "displayName": "value1 threshold",
                    "type": {
                        "numeric": true }
                }
				,
				"threshold_3": {
                    "displayName": "value3 threshold",
                    "type": {
                        "numeric": true }
                }
				,
				"threshold_2": {
                    "displayName": "value2 threshold",
                    "type": {
                        "numeric": true }
                }
				,
				"threshold_4": {
                    "displayName": "value4 threshold",
                    "type": {
                        "numeric": true }
                }
				
		}
	},
        "dataPoint": {
            "displayName": "Data colors",
            "properties": {
                "defaultColor": {
                    "displayName": "Default color",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                },
                "showAllDataPoints": {
                    "displayName": "Show all",
                    "type": {
                        "bool": true
                    }
                },
                "fill": {
                    "displayName": "Fill",
                    "type": {
                        "fill": {
                            "solid": {
                                "color": true
                            }
                        }
                    }
                },
                "fillRule": {
                    "displayName": "Color saturation",
                    "type": {
                        "fill": {}
                    }
                },
                 "fontSize": {
                    "displayName": "Text Size",
                    "type": {
                        "formatting": {
                            "fontSize": true
                        }
                    }
                }
            }
        }
    },
    "dataViewMappings": [
        {
            "categorical":
				{
                "categories": {
					"select": [
						
							{
							"for": {
								"in": "category"
							}
						},
						{
							"for": {
								"in": "date"
							}
						}
					],
					"dataReductionAlgorithm": {
						"bottom": {
						 "count": 1
					 }
					}
				},
                "values": {
				"group": {
            "by": "date",
                    "select": [		
						
						
						{
                            "bind": {
                                "to": "value1"
                            }
                        },
						{
                            "bind": {
                                "to": "value1_unit"
                            }
                        },
                        {
                            "bind": {
                                "to": "value2"
                            }
                        },{
                            "bind": {
                                "to": "value2_unit"
                            }
                        },
                        {
                            "bind": {
                                "to": "value3"
                            }
                        },{
                            "bind": {
                                "to": "value3_unit"
                            }
                        },
                        {
                            "bind": {
                                "to": "value4"
                            }
                        },{
                            "bind": {
                                "to": "value4_unit"
                            }
                        }

                    ]
					,
					"dataReductionAlgorithm": {
						"bottom": {
						 "count": 1
					 }
					}
					}
                }
            }
        }
    ]
}
v-viig
Community Champion
Community Champion

It works well to me. DataView contains single data-row for each date.

Can you share DataView object that you get in the update method?

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

ysapiyev
Responsive Resident
Responsive Resident

@v-viig,

 

I changed my data links, and now it is working. Thanks

Hi,

 

Can you please share, what exactly did you change to fix this

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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